- Online Barcode Generator
- How To
- Buy Now
GridView Default Context Menu Customizing
In this article, we are going to talk about the way of customizing the default Kettic DataGridView context menu in the ContextMenuOpening event handler. To create the custom context menu, we need to initialize the items of custom context menus, and then subscribe for the events that you are going to handle to achieve desired behavior. The following examples will demonstrate how to remove and add context menus items to GridView C#.NET component for Windows Forms application.
Remove Context Menu Items from C#.NET GridView
The DataGridView control allows users easily remove an item from default KetticGridView context menu. To remove an item, we need to make a loop to iterate the e.ContextMenu.Items first, and then we need to check whether the e.ContextMenu.Items.Text is equal to the text of the menu item that we are going to hide. If the conditions do like this, we can change the value of the Visibility of the menu item as Collapsed. The following are the C# code for deleting context menu items.
C# code for deleting context menu items from GridView C#.NET component in Windows Forms template project
Add Context Menu Items to C#.NET GridView
The DataGridView control allows users easily add menu items to the default Kettic DataGridView context menu. To add custom menu items to the default context menu in DataGridView control, we need to create menu item instances in the ContextMenuOpening event handler and add the instances to the e.ContextMenu.Items. The following are the C# code for adding custom context menu items.
C# code for adding custom context menu items to the default context menu in GridView for C# Windows Forms template project
UI Controlsfor Windows Forms.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls