views:

23

answers:

1

Hello,

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!

A: 

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

Dabblernl