void View_Click(object sender, RoutedEventArgs e) { NavBarGroup group = navBar.View.GetNavBarGroup(e); NavBarItem item = navBar.View.GetNavBarItem(e); if (group != null || item != null) { AddToStack("Click: " + (item != null ? GetItemContent(item) : GetGroupHeader(group)), clickCheckbox); } }
void navBar_MouseUp(object sender, RoutedEventArgs e) { NavBarGroup group = navBar.View.GetNavBarGroup(e); NavBarItem item = navBar.View.GetNavBarItem(e); if (group != null || item != null) { AddToStack("MouseUp: " + (item != null ? GetItemContent(item) : GetGroupHeader(group)), mouseUpCheckbox); } }
private void AddPreviewItem() { NavBarGroup group = (NavBarGroup)navBar.ActiveGroup; if (group == null) { return; } newItem = new NavBarItem() { Content = "Item " + (group.Items.Count + 1).ToString(), ImageSource = ((Image)images[newItemImageList.SelectedIndex]).Source, IsEnabled = false }; group.Items.Add(newItem); }
private void Add_Item(object sender, RoutedEventArgs e) { NavBarGroup group = (NavBarGroup)navBar.ActiveGroup; if (newItem != null) { newItem.IsEnabled = true; newItem = null; AddPreviewItem(); return; } group.Items.Add(new NavBarItem() { Content = "Item " + (group.Items.Count + 1).ToString(), ImageSource = ((Image)images[newItemImageList.SelectedIndex]).Source }); }
void GenerateContent(int groupsCount, int itemsCount) { navBar.Groups.Clear(); for (int i = 0; i < groupsCount; i++) { NavBarGroup group = new NavBarGroup(); group.Header = "Group " + (i + 1).ToString(); for (int j = 0; j < itemsCount; j++) { NavBarItem item = new NavBarItem(); item.Content = "Item " + (j + 1).ToString(); group.Items.Add(item); } navBar.Groups.Add(group); } }
public void SetLayout(NavBarItem item) { this.SuspendLayout(); this.Controls.Add(item); if (_navBarItems.Count == 0) { item.Top = this.Top; } else { item.Top = this[_navBarItems.Count - 1].Bottom + _barSpace; } //other process this.ResumeLayout(); }
string GetItemContent(NavBarItem item) { return(item != null?item.Content.ToString() : "null"); }