CommandBar overflow button customizing in WinForms C# Tutorial
The WinForms CommandBar control is a powerful and easy to use user interface control for Windows Forms. This CommandBar control provides large flexibility for developers to customize it. By using the WinForms CommandBar control, developers can customize the overflow buttons easily. The following is a tutorial that illustrates the process of accessing the Overflow button in CommandBar control for Windows Forms applications and customizing items including in the Overflow button control.
In the WinForms CommandBar control, the Overflow button is contained in each Command Bar Strip Element. There is a drop down list within the Overflow button, where users can find the menu items Add or Remove Buttons, Customize and MenuSeparatorItems. The drop down list will appear when the space is not enough for the items on the control.
How to Customize Overflow Button Drop Down Menu
Developers can reference to the samples to access the menu items under the Overflow button. The CustomizeButtonMenuItem and the AddRemoveButtonsMenuItem are exposed in the following examples.
When users want to hide the complete Overflow button, it is able to configure the value of the Visibility to Collapsed to hide the Overflow button.
How to Customize Control Context Menu
To customize the control context menu, we need to display the Customize menu option by right clicking the CommandBar control and selecting from the context menu list. The Customize menu is able to customize the strips. When the Customize menu is opened, the context menu will be populated and developers can customize the menu items.
The following C# code shows the process of subscribing this event, adding the custom item and removing the Customize option
How to Prevent Control from Gaining Focus
The default setting of the CommandBar Control allows focus receiving. If we want to disable the focus ability, we can achieve this via the following steps.
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