protected override void OnPointerPressed(PointerRoutedEventArgs e) { base.OnPointerPressed(e); NavigationBarItem element = VenturaVisualTreeHelper.FindParent <NavigationBarItem>(e.OriginalSource as DependencyObject); if (element != null) { MenubarItem item = (MenubarItem)element.DataContext; bool was_dropped = element.IsDroppedDown; SetAllChildrenAsNotDropped(); if (was_dropped == false) { element.IsDroppedDown = true; DisplayMenuPanel?.Invoke(this, item); } else { HideMenuPanel?.Invoke(); } } }
private void SetAllChildrenAsNotDropped() { foreach (var listitem in this.Items) { MenubarItem item = (MenubarItem)listitem; NavigationBarItem element = (NavigationBarItem)ContainerFromItem(item); element.IsDroppedDown = false; } }
public void ShowMenuPanel(MenubarItem invoked) { // This is needed this.RenderTransform = null; //.Margin = new Windows.UI.Xaml.Thickness(0, 0, 0, 0); _itemscontrol.ItemsSource = invoked.Categories; // This is needed to, otherwise the first-time-open height is incorrect. this.UpdateLayout(); if (_panelstatus == PanelStatus.Open) { return; } OpeningAnimation(); _panelstatus = PanelStatus.Open; }
private void NavigationBar_DisplayMenuPanel(NavigationBarControl sender, MenubarItem item) { MenuPanel.ShowMenuPanel(item); }
private void Control_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args) { _menubaritem = (MenubarItem)args.NewValue; ResetControls(); }