我从 ContextMenu 派生,在派生类中我需要手动引发 ContextMenuClosing 事件。我尝试了以下两种方法:
// On runtime tells me it can't convert from
// "System.Windows.RoutedEventArgs" to
// "System.Windows.Controls.ContextMenuEventArgs"
RaiseEvent(new RoutedEventArgs(ContextMenuClosingEvent));
// Second attempt: On compile time tells me,
// there's no constructor for ContextMenuEventArgs
OnContextMenuClosing(new ContextMenuEventArgs());
我是 RoutedEvents 的新手,有人可以帮我如何手动引发 ContextMenuClosing 事件吗?谢谢!