【发布时间】:2011-09-28 00:49:13
【问题描述】:
当我尝试获取 WPF 'rectangle' 的 eventinfo 时,如果 routedEvent 是对象的本机事件(例如 'MouseDown'),它会起作用(分配仅作为示例)。
DependencyObject d = rectangle;
string routedEvent = "MouseDown";
EventInfo eventInfo = d.GetType().GetEvent(routedEvent,
BindingFlags.Public | BindingFlags.Instance);
但是当我想在矩形上获取附加事件的 EventInfo(我认为我正确使用了该术语)时,例如:
string routedEvent = "Microsoft.Surface.Presentation.Contacts.ContactDownEvent";
GetEvent() 返回 null
关于如何获取附加事件的事件信息的任何想法。
谢谢
丹
【问题讨论】:
标签: wpf events reflection