Skip to main content

Sub Menu

  • 2 minutes to read

The Sub Menu is a flyout panel that allows you to extend the Main Menu.

Hamburger Sub Menu

To create a sub menu, place the HamburgerSubMenu control into the HamburgerMenu.Items collection. To specify the collection of sub menu items, use the HamburgerSubMenu.Items property. This collection accepts the HamburgerSubMenuNavigationButton objects.

You can display sub menu items directly in the main menu below the sub menu button in preview. To add a sub menu item to the preview, set its HamburgerSubMenuNavigationButton.ShowInPreview property to true.

You can also specify the flyout panel’s caption and its attributes using the HamburgerSubMenu.FlyoutHeader, HamburgerSubMenu.FlyoutHeaderHeight and HamburgerSubMenu.FlyoutHeaderPadding properties.

By default, when a sub menu item is selected, the item previously selected in the main menu is automatically deselected. Set the HamburgerSubMenu.IsStandaloneSelectionItemMode property to true to enable independent selection for the main menu and current sub-menu. If this option is enabled, selecting an item in the current sub-menu does not discard the selection in the main menu.

The markup below illustrates how to implement a HamburgerMenu with a sub menu.

<dx:ThemedWindow x:Class="DXApplication1.MainWindow"
                 xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                 xmlns:dxwui="http://schemas.devexpress.com/winfx/2008/xaml/windowsui"
                 xmlns:dxwuin="http://schemas.devexpress.com/winfx/2008/xaml/windowsui/navigation"
                 mc:Ignorable="d"
                 Title="MainWindow">
    <dxwui:HamburgerMenu>
        <dxwui:HamburgerSubMenu Content="Menu" Glyph="Icons/Menu.png">
            <dxwui:HamburgerSubMenu.Items>
                <dxwui:HamburgerSubMenuNavigationButton Content="MenuSubItem 1" PreviewContent="PreviewItem 1" ShowInPreview="True" SelectOnClick="False" RightContent="RC"/>
                <dxwui:HamburgerSubMenuNavigationButton Content="MenuSubItem 2" PreviewContent="PreviewItem 2" ShowInPreview="True" SelectOnClick="False"/>
                <dxwui:HamburgerSubMenuNavigationButton Content="MenuSubItem 3"/>
                <dxwui:HamburgerSubMenuNavigationButton Content="MenuSubItem 4" ShowPreviewMark="True"/>
            </dxwui:HamburgerSubMenu.Items>
        </dxwui:HamburgerSubMenu>
    </dxwui:HamburgerMenu>
</dx:ThemedWindow>