Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
See more:
How to avoid contextmenustrip while clicking in the empty area of a grid
Posted

Set the ContextMenuStrip property for each row in the grid and not for the grid.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 4-Mar-11 15:57pm    
It looks it should work, my 5. Don't you think the alternative approach is better? Please see my Answer.
--SA
Dalek Dave 4-Mar-11 19:04pm    
Good Answer
My answer is alternative. Your problem is net the menu itself, but probably selection, because you menu functionality is based on selection in a grid, right?

So, don't disable menu, modify the menu content depending on selection. If this is System.Windows.Forms.ContextMenu use the event Popup. For example, if nothing is selected on menu popup, hide selection-specific items, display only "Add...", "Help", etc.

–SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900