How to disable right click menu/ context menu of datagrid
-
Hello, In windows application we are using datagrid in readonly mode. If user right clicks on particular cell then copy/ paste menu is displaying. User is copying content and trying to paste in other cell, as datagrid is in readonly mode so user can't paste, but in first cell it is showing edit icon. We don't want that edit icon if datagrid is readonly, so I thought we can disable right click menu only. If any other solution is available for hiding edit icon, please let me know. Anybody if knows, solution for this, please give URL or sample code.
Thanks & Regards, Kumar
-
Hello, In windows application we are using datagrid in readonly mode. If user right clicks on particular cell then copy/ paste menu is displaying. User is copying content and trying to paste in other cell, as datagrid is in readonly mode so user can't paste, but in first cell it is showing edit icon. We don't want that edit icon if datagrid is readonly, so I thought we can disable right click menu only. If any other solution is available for hiding edit icon, please let me know. Anybody if knows, solution for this, please give URL or sample code.
Thanks & Regards, Kumar
-
Hello You can disable the contextmenu if you path an empty menu to the property of the control:
ContextMenu cm = new ContextMenu();
yourControl.ContextMenu = cm;Or you modify the existing menu liek you want.
All the best, Martin
Hello Martin, Thank you for your reply, but it is working for datagrid like column header. My problem is datagrid populated with few rows and columns, If I select from columns new menu is not displaying, it is displaying default windows right click menu i.e. Undo, Cut, Copy, Paste,Delete and Select All. I want to disable or hide this menu. once again thank you for your help.
Thanks & Regards, Kumar
-
Hello, In windows application we are using datagrid in readonly mode. If user right clicks on particular cell then copy/ paste menu is displaying. User is copying content and trying to paste in other cell, as datagrid is in readonly mode so user can't paste, but in first cell it is showing edit icon. We don't want that edit icon if datagrid is readonly, so I thought we can disable right click menu only. If any other solution is available for hiding edit icon, please let me know. Anybody if knows, solution for this, please give URL or sample code.
Thanks & Regards, Kumar
Hello, In .Net 2.0 version, windows form, we are using readonly datagrid. for this grid if user selects any cell and right click then windows context menu i.e. cut, copy, paste... is displaying. Now user is selecting some other cells and try to paste then in rowheader it is dispalying edit icon. We don't want this edit icon should be display at rowheader but context menu should be display. Your help is greatly appreciated.
Thanks & Regards, Kumar