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(HamburgerButtonStyle), StyleTargetType = typeof(Button))]
[TemplatePart(Name = "HamburgerButton", Type = typeof(Button))]
[TemplatePart(Name = "ButtonsListView", Type = typeof(ListBox))]
[TemplatePart(Name = "OptionsListView", Type = typeof(ListBox))]
[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))]
[StyleTypedProperty(Property = nameof(OptionsItemContainerStyle), StyleTargetType = typeof(ListBoxItem))]
public class HamburgerMenu : ContentControl
Attributes
| Type | Description |
|---|---|
| StyleTypedProperty | |
| TemplatePart | |
| TemplatePart | |
| TemplatePart | |
| StyleTypedProperty | |
| StyleTypedProperty | |
| StyleTypedProperty | |
| StyleTypedProperty | |
| StyleTypedProperty | |
| 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 | Item |
Event raised when an item is clicked
|
| ItemInvoked | Hamburger |
Event raised when an item is invoked
|
| OptionsItemClick | Item |
Event raised when an options' item is clicked
|
Fields
| Name | Constant Value | Summary |
|---|---|---|
| Can |
Identifies the
CanResizeOpenPane dependency property.static
|
|
| Compact |
Identifies the
CompactPaneLength dependency property.static
|
|
| Content |
Identifies the
ContentTransition dependency property.static
|
|
| DisplayModeProperty |
Identifies the
DisplayMode dependency property.static
|
|
| Hamburger |
Identifies the
HamburgerButtonClick routed event.static
|
|
| Hamburger |
Identifies the
HamburgerButtonHelpText dependency property.static
|
|
| Hamburger |
Identifies the
HamburgerButtonName dependency property.static
|
|
| Hamburger |
Identifies the
HamburgerButtonStyle dependency property.static
|
|
| Hamburger |
Identifies the
HamburgerButtonTemplate dependency property.static
|
|
| Hamburger |
Identifies the
HamburgerHeight dependency property.static
|
|
| Hamburger |
Identifies the
HamburgerMargin dependency property.static
|
|
| Hamburger |
Identifies the
HamburgerMenuHeaderTemplate dependency property.static
|
|
| Hamburger |
Identifies the
HamburgerVisibility dependency property.static
|
|
| Hamburger |
Identifies the
HamburgerWidth dependency property.static
|
|
| Header |
Identifies the
HeaderItemContainerStyle dependency property.static
|
|
| IsPaneOpenProperty |
Identifies the
IsPaneOpen dependency property.static
|
|
| ItemClickEvent |
Identifies the
ItemClick routed event.static
|
|
| Item |
Identifies the
ItemCommandParameter dependency property.static
|
|
| ItemCommandProperty |
Identifies the
ItemCommand dependency property.static
|
|
| Item |
Identifies the
ItemContainerStyle dependency property.static
|
|
| Item |
Identifies the
ItemFocusVisualStyle dependency property.static
|
|
| ItemInvokedEvent |
Identifies the
ItemInvoked routed event.static
|
|
| ItemTemplateProperty |
Identifies the
ItemTemplate dependency property.static
|
|
| Item |
Identifies the
ItemTemplateSelector dependency property.static
|
|
| ItemsSourceProperty |
Identifies the
ItemsSource dependency property.static
|
|
| Maximum |
Identifies the
MaximumOpenPaneLength dependency property.static
|
|
| Minimum |
Identifies the
MinimumOpenPaneLength dependency property.static
|
|
| Open |
Identifies the
OpenPaneLength dependency property.static
|
|
| Options |
Identifies the
OptionsItemClick routed event.static
|
|
| Options |
Identifies the
OptionsItemCommandParameter dependency property.static
|
|
| Options |
Identifies the
OptionsItemCommand dependency property.static
|
|
| Options |
Identifies the
OptionsItemContainerStyle dependency property.static
|
|
| Options |
Identifies the
OptionsItemTemplate dependency property.static
|
|
| Options |
Identifies the
OptionsItemTemplateSelector dependency property.static
|
|
| Options |
Identifies the
OptionsItemsSource dependency property.static
|
|
| Options |
Identifies the
OptionsVisibility dependency property.static
|
|
| Pane |
Identifies the
PaneBackground dependency property.static
|
|
| Pane |
Identifies the
PaneForeground dependency property.static
|
|
| Pane |
Identifies the
PaneHeaderMargin dependency property.static
|
|
| PaneMarginProperty |
Identifies the
PaneMargin dependency property.static
|
|
| Pane |
Identifies the
PanePlacement dependency property.static
|
|
| Resize |
Identifies the
ResizeThumbStyle dependency property.static
|
|
| Selected |
Identifies the
SelectedIndex dependency property.static
|
|
| SelectedItemProperty |
Identifies the
SelectedItem dependency property.static
|
|
| Selected |
Identifies the
SelectedOptionsIndex dependency property.static
|
|
| Selected |
Identifies the
SelectedOptionsItem dependency property.static
|
|
| Separator |
Identifies the
SeparatorItemContainerStyle dependency property.static
|
|
| Show |
Identifies the
ShowSelectionIndicator dependency property.static
|
|
| Vertical |
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.
|
| Hamburger |
string |
Gets or sets the
AutomationProperties.HelpTextProperty for the HamburgerMenu button.
|
| HamburgerButtonName | string |
Gets or sets the
AutomationProperties.NameProperty for the HamburgerMenu button.
|
| HamburgerButtonStyle | Style |
Gets or sets the
FrameworkElement.Style for the HamburgerMenu button.
|
| Hamburger |
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.
|
| Hamburger |
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.
|
| Header |
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.
|
| ItemTemplate | DataTemplate |
Gets or sets the
DataTemplate used to display each item.
|
| ItemTemplateSelector | DataTemplateSelector |
Gets or sets the
DataTemplateSelector used to display each item.
|
| 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.
|
| Maximum |
double |
Gets or sets the maximum width of the
SplitView pane when it's fully expanded.
|
| Minimum |
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.
|
| Options |
object |
Gets or sets the
ICommand parameter which will be passed by the OptionsItemCommand.
|
| Options |
Style |
Gets or sets the
Style used for each item in the options.
|
| OptionsItemTemplate | DataTemplate |
Gets or sets the
DataTemplate used to display each item in the options.
|
| Options |
DataTemplateSelector |
Gets or sets the
DataTemplateSelector used to display 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.
|
| 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 | Split |
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.
|
| Separator |
Style |
Gets or sets the
Style used for each separator item.
|
| Show |
bool |
Gets or sets whether a selection indicator will be shown on the HamburgerMenuItem.
|
| Vertical |
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.
|
| Raise |
void |
Executes the
OptionsItemCommand.
|
