HamburgerMenu Class

Summary

The HamburgerMenu is based on a SplitView control. By default it contains a HamburgerButton and a ListView to display menu items.
Namespace
MahApps.Metro.Controls
Base Types
  • ContentControl
graph BT Type-->Base0["ContentControl"] Type["HamburgerMenu"] class Type type-node

Syntax

[StyleTypedProperty(Property = nameof(OptionsItemContainerStyle), StyleTargetType = typeof(ListBoxItem))]
[StyleTypedProperty(Property = nameof(ResizeThumbStyle), StyleTargetType = typeof(MetroThumb))]
[StyleTypedProperty(Property = nameof(ItemContainerStyle), StyleTargetType = typeof(ListBoxItem))]
[StyleTypedProperty(Property = nameof(HeaderItemContainerStyle), StyleTargetType = typeof(ListBoxItem))]
[StyleTypedProperty(Property = nameof(SeparatorItemContainerStyle), StyleTargetType = typeof(ListBoxItem))]
[StyleTypedProperty(Property = nameof(ItemFocusVisualStyle), StyleTargetType = typeof(Control))]
[TemplatePart(Name = "HamburgerButton", Type = typeof(Button))]
[TemplatePart(Name = "ButtonsListView", Type = typeof(ListBox))]
[TemplatePart(Name = "OptionsListView", Type = typeof(ListBox))]
[StyleTypedProperty(Property = nameof(HamburgerButtonStyle), StyleTargetType = typeof(Button))]
public class HamburgerMenu : ContentControl

Attributes

Type Description
StyleTypedProperty
StyleTypedProperty
StyleTypedProperty
StyleTypedProperty
StyleTypedProperty
StyleTypedProperty
TemplatePart
TemplatePart
TemplatePart
StyleTypedProperty

Constructors

Name Summary
HamburgerMenu() Initializes a new instance of the HamburgerMenu class.

Events

Name Type Summary
HamburgerButtonClick RoutedEventHandler
Event raised when the hamburger button is clicked
ItemClick ItemClickRoutedEventHandler
Event raised when an item is clicked
ItemInvoked HamburgerMenuItemInvokedRoutedEventHandler
Event raised when an item is invoked
OptionsItemClick ItemClickRoutedEventHandler
Event raised when an options' item is clicked

Fields

Name Constant Value Summary
CanResizeOpenPaneProperty
Identifies the CanResizeOpenPane dependency property.
static
CompactPaneLengthProperty
Identifies the CompactPaneLength dependency property.
static
ContentTransitionProperty
Identifies the ContentTransition dependency property.
static
DisplayModeProperty
Identifies the DisplayMode dependency property.
static
HamburgerButtonClickEvent
Identifies the HamburgerButtonClick routed event.
static
HamburgerButtonHelpTextProperty
Identifies the HamburgerButtonHelpText dependency property.
static
HamburgerButtonNameProperty
Identifies the HamburgerButtonName dependency property.
static
HamburgerButtonStyleProperty
Identifies the HamburgerButtonStyle dependency property.
static
HamburgerButtonTemplateProperty
Identifies the HamburgerButtonTemplate dependency property.
static
HamburgerHeightProperty
Identifies the HamburgerHeight dependency property.
static
HamburgerMarginProperty
Identifies the HamburgerMargin dependency property.
static
HamburgerMenuHeaderTemplateProperty
Identifies the HamburgerMenuHeaderTemplate dependency property.
static
HamburgerVisibilityProperty
Identifies the HamburgerVisibility dependency property.
static
HamburgerWidthProperty
Identifies the HamburgerWidth dependency property.
static
HeaderItemContainerStyleProperty
Identifies the HeaderItemContainerStyle dependency property.
static
IsPaneOpenProperty
Identifies the IsPaneOpen dependency property.
static
ItemClickEvent
Identifies the ItemClick routed event.
static
ItemCommandParameterProperty
Identifies the ItemCommandParameter dependency property.
static
ItemCommandProperty
Identifies the ItemCommand dependency property.
static
ItemContainerStyleProperty
Identifies the ItemContainerStyle dependency property.
static
ItemFocusVisualStyleProperty
Identifies the ItemFocusVisualStyle dependency property.
static
ItemInvokedEvent
Identifies the ItemInvoked routed event.
static
ItemsSourceProperty
Identifies the ItemsSource dependency property.
static
ItemTemplateProperty
Identifies the ItemTemplate dependency property.
static
ItemTemplateSelectorProperty
Identifies the ItemTemplateSelector dependency property.
static
MaximumOpenPaneLengthProperty
Identifies the MaximumOpenPaneLength dependency property.
static
MinimumOpenPaneLengthProperty
Identifies the MinimumOpenPaneLength dependency property.
static
OpenPaneLengthProperty
Identifies the OpenPaneLength dependency property.
static
OptionsItemClickEvent
Identifies the OptionsItemClick routed event.
static
OptionsItemCommandParameterProperty
Identifies the OptionsItemCommandParameter dependency property.
static
OptionsItemCommandProperty
Identifies the OptionsItemCommand dependency property.
static
OptionsItemContainerStyleProperty
Identifies the OptionsItemContainerStyle dependency property.
static
OptionsItemsSourceProperty
Identifies the OptionsItemsSource dependency property.
static
OptionsItemTemplateProperty
Identifies the OptionsItemTemplate dependency property.
static
OptionsItemTemplateSelectorProperty
Identifies the OptionsItemTemplateSelector dependency property.
static
OptionsVisibilityProperty
Identifies the OptionsVisibility dependency property.
static
PaneBackgroundProperty
Identifies the PaneBackground dependency property.
static
PaneForegroundProperty
Identifies the PaneForeground dependency property.
static
PaneHeaderMarginProperty
Identifies the PaneHeaderMargin dependency property.
static
PaneMarginProperty
Identifies the PaneMargin dependency property.
static
PanePlacementProperty
Identifies the PanePlacement dependency property.
static
ResizeThumbStyleProperty
Identifies the ResizeThumbStyle dependency property.
static
SelectedIndexProperty
Identifies the SelectedIndex dependency property.
static
SelectedItemProperty
Identifies the SelectedItem dependency property.
static
SelectedOptionsIndexProperty
Identifies the SelectedOptionsIndex dependency property.
static
SelectedOptionsItemProperty
Identifies the SelectedOptionsItem dependency property.
static
SeparatorItemContainerStyleProperty
Identifies the SeparatorItemContainerStyle dependency property.
static
ShowSelectionIndicatorProperty
Identifies the ShowSelectionIndicator dependency property.
static
VerticalScrollBarOnLeftSideProperty
Identifies the VerticalScrollBarOnLeftSide dependency property.
static

Properties

Name Value Summary
CanResizeOpenPane bool
Gets or Sets whether the open pane can be resized by the user. The default value is false.
CompactPaneLength double
Gets or sets the width of the pane when in its compact display mode.
ContentTransition TransitionType
Gets or sets the TransitionType for the TransitioningContentControl which shows the selected menu item content.
DisplayMode SplitViewDisplayMode
Gets or sets a value that specifies how the pane and content areas are shown.
HamburgerButtonHelpText string
Gets or sets the AutomationProperties.HelpTextProperty for the HamburgerMenu button.
HamburgerButtonName string
Gets or sets theAutomationProperties.NameProperty for the HamburgerMenu button.
HamburgerButtonStyle Style
Gets or sets the FrameworkElement.Style for the HamburgerMenu button.
HamburgerButtonTemplate DataTemplate
Gets or sets the ContentControl.ContentTemplate for the HamburgerMenu button.
HamburgerHeight double
Gets or sets the FrameworkElement.Height for the HamburgerMenu button.
HamburgerMargin Thickness
Gets or sets the margin for the HamburgerMenu button.
HamburgerMenuHeaderTemplate DataTemplate
Gets or sets the ContentControl.ContentTemplate for the HamburgerMenu pane header.
HamburgerVisibility Visibility
Gets or sets the UIElement.Visibility for the HamburgerMenu button.
HamburgerWidth double
Gets or sets HamburgerMenu button's FrameworkElement.Width.
HeaderItemContainerStyle Style
Gets or sets the Style used for each header item.
IsPaneOpen bool
Gets or sets a value indicating whether the pane is expanded to its full width.
ItemCommand ICommand
Gets or sets a ICommand which will be executed if an item was clicked by the user.
ItemCommandParameter object
Gets or sets the ICommand parameter which will be passed by the ItemCommand.
ItemContainerStyle Style
Gets or sets the Style used for each item.
ItemFocusVisualStyle Style
Gets or sets the default FocusVisualStyle for a HamburgerMenuItem. This style can be override at the HamburgerMenuItem style by setting the FocusVisualStyle property.
Items ItemCollection
Gets the collection used to generate the content of the items list.
ItemsSource object
Gets or sets an object source used to generate the content of the menu.
ItemTemplate DataTemplate
Gets or sets the DataTemplate used to display each item.
ItemTemplateSelector DataTemplateSelector
Gets or sets the DataTemplateSelector used to display each item.
MaximumOpenPaneLength double
Gets or sets the maximum width of the SplitView pane when it's fully expanded.
MinimumOpenPaneLength double
Gets or sets the minimum width of the SplitView pane when it's fully expanded.
OpenPaneLength double
Gets or sets the width of the pane when it's fully expanded.
OptionsItemCommand ICommand
Gets or sets a ICommand which will be executed if an options item was clicked by the user.
OptionsItemCommandParameter object
Gets or sets the ICommand parameter which will be passed by the OptionsItemCommand.
OptionsItemContainerStyle Style
Gets or sets the Style used for each item in the options.
OptionsItems ItemCollection
Gets the collection used to generate the content of the option list.
OptionsItemsSource object
Gets or sets an object source used to generate the content of the options.
OptionsItemTemplate DataTemplate
Gets or sets the DataTemplate used to display each item in the options.
OptionsItemTemplateSelector DataTemplateSelector
Gets or sets the DataTemplateSelector used to display each item in the options.
OptionsVisibility Visibility
Gets or sets the Visibility of the options menu.
PaneBackground Brush
Gets or sets the Brush to apply to the background of the pane area of the HamburgerMenu.
PaneForeground Brush
Gets or sets the Brush to apply to the foreground of the pane area of the HamburgerMenu.
PaneHeaderMargin Thickness
Gets or sets the margin for the pane header.
PaneMargin Thickness
Gets or sets the margin for the SplitView pane.
PanePlacement SplitViewPanePlacement
Gets or sets a value that specifies whether the pane is shown on the right or on left side of the HamburgerMenu.
ResizeThumbStyle Style
Gets or Sets the Style for the resizing Thumb (type of MetroThumb)
SelectedIndex int
Gets or sets the selected menu index.
SelectedItem object
Gets or sets the selected menu item.
SelectedOptionsIndex int
Gets or sets the selected options menu index.
SelectedOptionsItem object
Gets or sets the selected options menu item.
SeparatorItemContainerStyle Style
Gets or sets the Style used for each separator item.
ShowSelectionIndicator bool
Gets or sets whether a selection indicator will be shown on the HamburgerMenuItem.
VerticalScrollBarOnLeftSide bool
Gets or sets whether the ScrollBar of the HamburgerMenu is on the left side or on the right side of the menu items.

Methods

Name Value Summary
OnApplyTemplate() void
Override default OnApplyTemplate to capture children controls
RaiseItemCommand() void
Executes the ItemCommand.
RaiseOptionsItemCommand() void
Executes the OptionsItemCommand.