Customize the overflow button
This article will demonstrate how to access the Overflow button in RadCommandBar and how to customize its items.
Each CommandBarStripElement has its own Overflow button. This button has a drop down, which contains of "Add or Remove Buttons" menu item, "Customize..." menu item and RadMenuSeparatorItems items. Additionally, if there is not enough space on the control to fit all the items, they will be displayed in the drop down menu as well.
The following example, demonstrates how to access the RadMenuItems of the Overflow button. For your convenience we have exposed the CustomizeButtonMenuItem and the AddRemoveButtonsMenuItem.
//Change the font of the AddRemoveButtonMenuItem
radCommandBarStripElement1.OverflowButton.AddRemoveButtonsMenuItem.Font = new System.Drawing.Font("Arial", 12f);
//Change the font of the CustomizeButtonMenuItem
radCommandBarStripElement1.OverflowButton.CustomizeButtonMenuItem.Font = new System.Drawing.Font("Segoe UI", 10f, FontStyle.Bold);
//hide the separators
foreach (var item in radCommandBarStripElement1.OverflowButton.DropDownMenu.Items)
{
RadMenuSeparatorItem separator = item as RadMenuSeparatorItem;
if (separator != null)
{
separator.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
}
}
'Change the font of the AddRemoveButtonMenuItem
CommandBarStripElement1.OverflowButton.AddRemoveButtonsMenuItem.Font = New System.Drawing.Font("Arial", 12.0F)
'Change the font of the CustomizeButtonMenuItem
CommandBarStripElement1.OverflowButton.CustomizeButtonMenuItem.Font = New System.Drawing.Font("Segoe UI", 10.0F, FontStyle.Bold)
'hide the separators
For Each item In CommandBarStripElement1.OverflowButton.DropDownMenu.Items
Dim separator As RadMenuSeparatorItem = TryCast(item, RadMenuSeparatorItem)
If separator IsNot Nothing Then
separator.Visibility = Telerik.WinControls.ElementVisibility.Collapsed
End If
Next
Alternatively, if you need to hide the whole Overflow button, simply set its Visibility property to Collapsed
radCommandBarStripElement1.OverflowButton.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
CommandBarStripElement1.OverflowButton.Visibility = Telerik.WinControls.ElementVisibility.Collapsed