简体   繁体   中英

Creating custom event handler for a RoutedEvent

Given a routed event identifier.

It is posible using reflection to create a Handler for that event?? (and of course add some code inside the handler).

There are only very limited number of truely Routed Events in Silverlight, they are all defined on the UIElement (except for Loaded on the FrameworkElement ).

If its one of these to which you refer then rather than using reflection it would be easier to simply compare the provided RoutedEvent object with one of these few known ones. Once established you will know which of the a limited number of possible signatures to use.

不确定这是否是您正在寻找的,但您是否考虑过Func和Action代表?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM