How do you capture the WindowContextMenu Event?

Docking/MDI for WPF Forum

Posted 12 years ago by Scott Doyle
Version: 11.2.0554
Avatar

I noticed that there is an event called WindowContextMenuEvent in the help documentation, but not sure how to use it.

Can someone show an example of this in code?

Thanks,

Scott

Comments (3)

Answer - Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Scott,

The main Features demo handles the WindowContextMenu event and displays the context menu's source location in the Output tool window.  From within that event you could modify the e.ContextMenu however appropriate to suit your needs (add/remove items, etc.).


Actipro Software Support

Posted 12 years ago by Scott Doyle
Avatar

If I wanted to execute code after one of the following menu items are selected:

New Horizontal Tab Group, New Vertical Tab Group, Move to Next Tab Group, or Move to Previous Tab Group.

I would need to override the command from the WindowContextMenu event to execute the method (i.e. MoveToNewHorizontalContainer(),...) and then execute my code.

Is this correct?

It would be nice to have an event that gets called before and after a context menu command so that a developer could run custom code.

Thanks,

Scott

[Modified 12 years ago]

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Scott,

Well for that sort of thing you could just remove our Command that is set on the MenuItem and add your own event handler instead.  Then in your handler, execute the command that would have been executed on the CommandTarget.  You could put your custom code before or after the command call in that case.


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.