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
695
How to disable contextmenustrip for 2nd column of the ultragrid
posted

Hello,

I am having a ultragrid with 3 columns. I have applied the context menu strip for the ultragrid. I would like to have the context menu strip only for the first column and the last column. NO context menu strip in the 2nd column. How should i achieve the same ?

sample application attached. Don't want the context menu strip to be available for the 2nd column. How ?

Thanks

 

UltraGridCopyPasteFunctionality.zip
  • 469350
    Offline posted

    Hi,

    A ContextMenu or ContextMenu strip always applies to the whole control. So the only way to deal with this would be to change the ContextMenuStrip based on the current location of the mouse.

    So trap either the MouseMove or MouseDown events and set the ContextMenuStrip to your ContextMenuStrip or null depending on where the mouse is. To determine which column the mouse is over, check out this article:

    HOWTO:UltraWinGrid Mouse Position and Column Identification