Difference Between RoutedEventHandler and EventHan

2020-08-23 04:31发布

What is the difference between

this.Loaded += new RoutedEventHandler(MainWindow_Loaded);

and

childWindow.MyEvent += new EventHandler(childWindow_MyEvent);

2条回答
别忘想泡老子
2楼-- · 2020-08-23 04:45

I assume you want to know what's the difference between Events and Routed Events. These 2 articles might help you:

https://msdn.microsoft.com/en-us/library/ms742806(v=vs.100).aspx (a MSDN article)

http://joshsmithonwpf.wordpress.com/2008/03/18/understanding-routed-commands/ (a great article about Routed Commands that also contains a very nice explanation of Routed Events)

查看更多
啃猪蹄的小仙女
3楼-- · 2020-08-23 04:51

In short, RoutedEvents are routed. They can bubble up or drill down the visual tree until they hit a handler.

Standard events are just plain direct subscription.

查看更多
登录 后发表回答