adding item to document window's context menu in TDI mode?

Docking/MDI for WPF Forum

Posted 14 years ago by Daniel Chong
Avatar
Hi, I was wondering if it's possible to add a menu item to the context menu that you see when you right click on a tab in TDI mode for the document window. Normally, the context menu says
" Close
--------
New Horizontal Tab Group
New Vertical Tab Group "

I would like to add my own field at the end.

Is this possible?

Thanks a lot,
Dan.

Comments (3)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Daniel,

Sure, just handle the DockSite.WindowContextMenu event. It passes the default menu and you can cancel it or customize it as you need before it displays.


Actipro Software Support

Posted 13 years ago by ryan phelps
Avatar
Hi Support,

I'm new to the ActiPro controls but I'm looking to do exactly what the original post states, to add a custom menu item. Could you please give a code sample on how to add an item to the menu that is shown when you right click on a tab and raise an event for the new item.

I'm really stuck with this one so any help would be appreciated.

Thanks,

Ryan.
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Ryan,

Sorry, but we don't currently have a sample like that. You'd just need to attach a handler to the WindowContextMenu event on the DockSite. You can do this in your XAML or in the code-behind. In that handler, you can check the ContextMenuType of the event arguments. If it's DockingContextMenuType.TabbedMdiContainerOverflowButton, then you know it's for the tabbed MDI button.

Once you have that, you can customize the ContextMenu of the event arguments like any other WPF ContextMenu. You can either completely replace it, or simply add/remove items from the ContextMenu.Items collection.


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.