Wpf event not bubbling

前端 未结 4 1443
野趣味
野趣味 2021-01-03 06:50

Here is my XAML:



        
4条回答
  •  甜味超标
    2021-01-03 06:53

    There is an override available to handle events, even though they were marked as handled. It requires that you add your handler through code as the following:

    MainWindow.AddHander(UIElement.MouseUpEvent, new MouseButtonEventHandler(button1_MouseUp), true);
    

    That last parameter specifies whether you want to accept events that were handled already or not. If you add that handler to your main window, you'll notice that the routed MouseUp events from your button are indeed bubbling up, (but their e.Handled indicates that they were already handled).

提交回复
热议问题