HamburgerMenu Class

Control to implement the Hamburger style menu (or Navigation Drawer) control.

Definition

Namespace: Common.Wpf.Controls
Assembly: Common.Wpf.Controls (in Common.Wpf.Controls.dll) Version: 2.0.7
C#
public class HamburgerMenu : Control
Inheritance
Object    DispatcherObject    DependencyObject    Visual    UIElement    FrameworkElement    Control    HamburgerMenu

Remarks

1. Add a namespace attribute to the root element of the markup file it is to be used in:
XAML
xmlns:cc="clr-namespace:Common.Wpf.Controls;assembly=Common.Wpf.Controls"
2. Define the control with menu items:
XAML
<cc:HamburgerMenu IsOpen="{Binding IsChecked, ElementName=cbToggleMenu}" ...>
  <custom:HamburgerMenu.Content>
    <StackPanel Margin="0 10">
      <custom:HamburgerMenuItem>
        <TextBlock Text="Introduction"/>
      </custom:HamburgerMenuItem>
    </StackPanel>
  </custom:HamburgerMenu.Content>
</cc:HamburgerMenu>
3. In the ViewModel create the properties for binding:
C#
public bool IsMenuOpen => _navigationStore.IsMenuOpen;

Constructors

HamburgerMenuInitializes a new instance of the HamburgerMenu class.

Properties

ContentGets or sets the menu content.
FallBackOpenWidthGets or sets the fall-back menu open width. The default is 100.
IsOpenGets or sets the menu open indicator. The default is .
OpenCloseDurationGets or sets the menu open duration. The default is Automatic.

Fields

ContentPropertyIdentifies the Content dependency property.
FallBackOpenWidthPropertyIdentifies the FallBackOpenWidth dependency property.
IsOpenPropertyIdentifies the IsOpen dependency property.
OpenCloseDurationPropertyIdentifies the OpenCloseDuration dependency property.

See Also