public void Add(SidebarItem value) { if (value.Name == null) { throw new ArgumentNullException("Name value expected"); } foreach (SidebarItem i in registrar) { if (i.Name == value.Name) { return; } } if (value.Icon == null) { value.Icon = (BitmapImage)Resources["I_Item_Default"]; } registrar.Add(value); }
private void Grid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { SidebarItem v = ((Grid)sender).DataContext as SidebarItem; foreach (SidebarItem i in registrar) { if (i.uiElement != null) { i.uiElement.Visibility = Visibility.Hidden; i.isSelected = false; } } if (v.uiElement != null) { v.uiElement.Visibility = Visibility.Visible; } v.isSelected = true; DataContext = null; DataContext = this; }