Back to Devexpress

RibbonControl.OptionsExpandCollapseMenu Property

windowsforms-devexpress-dot-xtrabars-dot-ribbon-dot-ribboncontrol-efa06f65.md

latest3.5 KB
Original Source

RibbonControl.OptionsExpandCollapseMenu Property

Gets the availability and behavior settings of the Ribbon Display Options popup menu.

Namespace : DevExpress.XtraBars.Ribbon

Assembly : DevExpress.XtraBars.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DXCategory("Behavior")]
[XtraSerializableProperty(XtraSerializationVisibility.Content)]
public RibbonOptionsExpandCollapseMenu OptionsExpandCollapseMenu { get; }
vb
<DXCategory("Behavior")>
<XtraSerializableProperty(XtraSerializationVisibility.Content)>
Public ReadOnly Property OptionsExpandCollapseMenu As RibbonOptionsExpandCollapseMenu

Property Value

TypeDescription
RibbonOptionsExpandCollapseMenu

An object with settings that specify the availability and behavior of the Ribbon Display Options popup menu.

|

Remarks

The following example demonstrates how to enable the Ribbon Display Options menu:

csharp
using DevExpress.Utils;
using DevExpress.XtraBars.Ribbon;

private void Form1_Load(object sender, EventArgs e) {
    EnableRibbonExpandCollapseMenu();
}
void EnableRibbonExpandCollapseMenu() {
    ribbonControl1.OptionsExpandCollapseMenu.EnableExpandCollapseMenu = DefaultBoolean.True;
    ribbonControl1.OptionsExpandCollapseMenu.ShowRibbonLayoutGroup = DefaultBoolean.True;
    ribbonControl1.ExpandCollapseMenuShowing += RibbonControl1_ExpandCollapseMenuShowing;
}
private void RibbonControl1_ExpandCollapseMenuShowing(object sender, ExpandCollapseMenuShowingEventArgs e) {
    // Use 'e.Menu' to add new menu items aor customize the existing menu items.
    // e.Menu.AddItem(barItem);
    // e.Menu.ItemLinks[0].Caption = "CUSTOM_CAPTION";

    // Prevents the menu from being displayed.
    // e.Allow = false;
}
vb
Imports DevExpress.Utils
Imports DevExpress.XtraBars.Ribbon

Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
    EnableRibbonExpandCollapseMenu()
End Sub
Private Sub EnableRibbonExpandCollapseMenu()
    ribbonControl1.OptionsExpandCollapseMenu.EnableExpandCollapseMenu = DefaultBoolean.True
    ribbonControl1.OptionsExpandCollapseMenu.ShowRibbonLayoutGroup = DefaultBoolean.True
    AddHandler ribbonControl1.ExpandCollapseMenuShowing, AddressOf RibbonControl1_ExpandCollapseMenuShowing
End Sub
Private Sub RibbonControl1_ExpandCollapseMenuShowing(ByVal sender As Object, ByVal e As ExpandCollapseMenuShowingEventArgs)
    ' Use e.Menu to add new menu items aor customize the existing menu items.
    ' e.Menu.AddItem(barItem);
    ' e.Menu.ItemLinks[0].Caption = "CUSTOM_CAPTION";

    ' Prevents the menu from being displayed.
    ' e.Allow = false;
End Sub

The following screenshot shows the result:

See Also

RibbonControl Class

RibbonControl Members

DevExpress.XtraBars.Ribbon Namespace