1

I'm deriving from ContextMenu and inside the derived class I need to raise the ContextMenuClosing event manually. I tried the following two ways:

// 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());

I'm new to RoutedEvents, can someone please help me how to raise the ContextMenuClosing event manually? Thanks!

stefan.at.kotlin
  • 15,347
  • 38
  • 147
  • 270

1 Answers1

0

In this question the poster shows code in which he seems to be able to instantiate ContextMenuEventArgs even though its constructor is private

Community
  • 1
  • 1
Dabblernl
  • 15,831
  • 18
  • 96
  • 148