public void AllowFolders(bool showFolders) { if (!showFolders) { FlatItemPrototypes.Remove(FlatItemPrototypes.Where(i => i.IsContainer).ToList()); foreach (var group in ItemPrototypes) { group.Remove(group.Where(i => i.IsContainer).ToList()); } ItemPrototypes.Remove(ItemPrototypes.Where(i => i.Count == 0).ToList()); if (ItemPrototypes.Count > 0 && ItemPrototypes[0].Count > 0) { SelectedPrototype = ItemPrototypes[0][0]; } } }
private void DeleteOnClick(object sender, RoutedEventArgs e) { if (SelectedItem != null) { ItemPrototypes.Remove(SelectedItem); SelectedItem = null; ItemControl = null; if (!ItemPrototypes.Any()) { AddItem(); } SelectedItem = ItemPrototypes[0]; OnPropertyChanged(nameof(SelectedItem)); OnPropertyChanged(nameof(ItemControl)); } }