Articles in this section
Category / Section

How to remove dock context menu for a particular WinForms Docking Manager control?

1 min read

Context menu event

The WinForms DockingManager has an event called DockContextMenu.This event will get fired before showing the menu.We could remove menu by handling this event.

The event handler has an argument of type DockContextMenuEventArgs.That arguement has 2 properties ContextMenu of type PopupMenu and Owner of type control.ContextMenu gives access to the menu which is going to be displayed and Owner identifies the docked control.So by checking this Owner object we can remove the contextmenu for a particular control.

C#

// EventHandler for DockContextMenu
private void dockingManager1_DockContextMenu(object
sender,Syncfusion.Windows.Forms.Tools.DockContextMenuEventArgs arg)
{
    if(arg.Owner==calculatorControl1) 
       arg.ContextMenu=new Syncfusion.Windows.Forms.Tools.XPMenus.PopupMenu();
}

 

VB

' EventHandler for DockContextMenu
Private Sub dockingManager1_DockContextMenu(ByVal sender As Object, ByVal arg As Syncfusion.Windows.Forms.Tools.DockContextMenuEventArgs)
Handles dockingManager1.DockContextMenu
If arg.Owner Is calculatorControl1 Then 
    arg.ContextMenu = New Syncfusion.Windows.Forms.Tools.XPMenus.PopupMenu()
End Sub

 

UG document link: https://help.syncfusion.com/windowsforms/dockingmanager/docking-events#dockcontextmenu-event

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied