1

ContextMenuから派生しており、派生クラス内でContextMenuClosingイベントを手動で発生させる必要があります。次の2つの方法を試しました。

// 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イベントを手動で発生させる方法を教えてもらえますか?ありがとう!

4

1 に答える 1

0

この質問では、ポスターは、コンストラクターがプライベートであっても ContextMenuEventArgs をインスタンス化できるように見えるコードを示しています

于 2010-08-01T21:11:30.930 に答える