private void UpdateMarginToFitHamburgerMenu(HamburgerMenu hamburgerMenu = null) { hamburgerMenu = hamburgerMenu ?? ParentHamburgerMenu; if (hamburgerMenu == null) { Margin = new Thickness(0); return; } switch (hamburgerMenu.DisplayMode) { case SplitViewDisplayMode.Overlay: { var buttonVisible = hamburgerMenu.HamburgerButtonVisibility == Visibility.Visible; Margin = buttonVisible ? new Thickness(0) : new Thickness(48, 0, 0, 0); } break; case SplitViewDisplayMode.Inline: case SplitViewDisplayMode.CompactOverlay: case SplitViewDisplayMode.CompactInline: { Margin = new Thickness(0); } break; } }
private void RegisterHamburgerMenuChanges(HamburgerMenu hamburgerMenu) { hamburgerMenu = hamburgerMenu ?? ParentHamburgerMenu; if (hamburgerMenu == null) { return; } hamburgerMenu.UnregisterPropertyChangedCallback(HamburgerMenu.IsOpenProperty, callBackIsOpenId ?? 0); callBackIsOpenId = hamburgerMenu.RegisterPropertyChangedCallback(HamburgerMenu.IsOpenProperty, (obj, dp) => OnHamburgerMenuIsOpenPropertyChanged(obj as HamburgerMenu)); hamburgerMenu.UnregisterPropertyChangedCallback(HamburgerMenu.DisplayModeProperty, callBackDisplayModeId ?? 0); callBackDisplayModeId = hamburgerMenu.RegisterPropertyChangedCallback(HamburgerMenu.DisplayModeProperty, (obj, dp) => OnHamburgerMenuDisplayModePropertyChanged(obj as HamburgerMenu)); }
private void RegisterHamburgerMenuChanges() { deRegHamburgerEvents = null; // default on PageHeader startup var hamburgerMenu = ParentHamburgerMenu; if (hamburgerMenu != null) { deRegHamburgerEvents = hamburgerMenu; // remember to deregister on UnLoaded event hamburgerMenu.IsOpenChanged += HamburgerMenu_IsOpenChanged; hamburgerMenu.DisplayModeChanged += HamburgerMenu_DisplayModeChanged; hamburgerMenu.HamburgerButtonVisibilityChanged += HamburgerMenu_HamburgerButtonVisibilityChanged; } }
private void UpdateMargin(HamburgerMenu ham) { var value = (ham.IsOpen) ? ham.PaneWidth : 48d; BottomAppBar.Margin = new Thickness(value, 0, 0, 0); }
private void OnHamburgerMenuIsOpenPropertyChanged(HamburgerMenu hamburgerMenu) => UpdateMarginToFitHamburgerMenu(hamburgerMenu);
private void OnHamburgerMenuDisplayModePropertyChanged(HamburgerMenu hamburgerMenu) => UpdateMarginToFitHamburgerMenu(hamburgerMenu);