Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
655
UltraDockManager - Removing "Hide" menu item from context menu
posted

Hi,

I'm working with dockable Winforms using UltraDockManager, I have seen that it's possible to disable the "Hide" context menu item
(x.DefaultPaneSettings.AllowClose = DefaultableBoolean.False) but it's possible also to remove completely the "Hide" menu item from the context menu ?

Regards

Parents
  • 23930
    Offline posted

    Hi Christian,

     

    Thank you for posting in our forums.

     

    Currently the ContextMenu of the UltraDockManager is not publicly exposed so you can’t remove items directly from it. What you could do is to get it when the user clicks on the pane caption. In order to do that subscribe to the MouseEnterElement and MouseLeaveElement events of the UltraDockManger. In the MouseEneterElement event if the user has entered an element of type PaneCaptionUIElement subscribe to the MouseDown event of its Control. In the MouseLeaveElement unsubscribe to this event. Then in the MouseDown event you can access the context menu directly form the ContextMenu property of the sender. However its items won’t be populated at that time so we need to subtribe to the context menu’s Popup event. In the Popup event the items will be populated so we can easily remove the hide item.

     

    I have attached a small sample which demonstrates this approach.

     

    Please let me know if you have any additional questions.

    WD_RemoveContextMenuItem.zip
Reply Children