Adding and Removing Menus Items in C#.NET
Kettic Menu Controls provides easy approaches for the users to add and remove menu items in C#.NET project. Moreover, it is able to add sub menu items to the main menus and populate the drop-down list by using the Kettic MenuComboItems. This Kettic Menu Controls allows the users to customize the menu performance when performing long running operations. To add menus, we need to user the Menu Items collections and to populate the drop-down list, we need to use the ComboBoxElement.
How to Add Menu Items in C#.NET
This section mainly demonstrates how to add main menu items. Kettic Menu control contains the KetticMenu items collection for adding the main menu items to your applications and the KetticMenuItem items collection for adding the sub menu items. The C# code examples below show how to use overload of the KetticMenuItem. The first one applies a parameter-less constructor, assigns the KetticMenuItem Text property and finally adds the menu item to the KetticMenu Items collection. The second one uses a single string Text parameter, includes and adds menu items all at one time. And the third one applies a constructor with a second object Tag parameter storing any arbitrary data in.
C# code for constructing and adding menu items to your C#.NET projects
How to Add Sub Menu Items in C#.NET
The approach to add sub menu items is the same as that to add main menu items. This is accomplished by using the KetticMenuItems collection. The C# code below will retrieve a reference to the Student ID and add a few KetticMenuItems to the Student ID menu Items collection. In addition, a Click event handler will be attached to the Height menu item
C# code for adding sub menu items to the main menu
How to Add a KetticMenuComboItem
KetticMenuComboItems allows the users to add drop down list to menus. It has no parameters and populates the drop down list by using the ComboBoxElement Items collection.
C# code for adding sub menu items to Height menu
How to Customize Menu Performance in C#.NET
Kettic Menu controls contains the methods, StartInit() and EndInit(), for suspending layout of the menu to enhance the performance while performing long running operations like loading a number of menu items from a database.
C# code snippet for suspending the layout for performing operations
How to Remove Menu Items
Kettic Menu controls provides the Remove() or RemoveAt() methods to delete menu items from the items collection. The Remove() method is used to take a reference to the menu item to be removed and the RemoveAt() method is able to take integer position of the item in the collection.
C# code for removing menu items
| ![]() UI Controlsfor Windows Forms .NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI DesignWinForms UI Controls WinForms Buttons UI Control WinForms Calendar UI ControlWinForms Carousel UI ControlWinForms Chart UI ControlWinForms Clock UI ControlCommandBar UI ControlWinForms Dock UI ControlDesktop Alert UI ControlDropDown List UI ControlWinForms Editor UI ControlForms and Dialogs UI ControlWinForms GridView UI ControlWinForms ListView UI ControlWinForms Menu UI ControlMenu - Get Started in C#Menu - Menu DesignerMenu - Working with ItemsAdd / RemoveMulti-Line TextEventsMenu - Styling & AppearanceMenu OrientationMenu BackgroundMenu Item ImagesAnimation EffectsMenu - Menu MergeMenu - Application MenuMenu - Context MenuWinForms ComboBox UI ControlWinForms PageView UI ControlPanels and Labels UI ControlWinForms Panorama UI ControlWinForms PDFViewer UI ControlWinForms Property Grid UI ControlWinForms Ribbon UI ControlWinForms PivotGrid UI ControlWinForms RichTextBox UI ControlWinForms Rotator UI ControlWinForms Scheduler UI ControlWinForms Shortcuts UI ControlWinForms SpellChecker UI ControlWinForms Track & Status UI ControlWinForms TreeView UI ControlWinForms Wizard UI ControlWinForms Test UI ControlWinForms Theme UI Control |