We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Platform: WinForms |
Control: DockingManager |
Published Date: April 30, 2011 |
Last Revised Date: December 5, 2019

Context menu event

The 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

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon