private static void UpdateVisibility(ThemeModel themeModel, ThemeTreeItem item) { ThemeItemModel themeItemModel = item as ThemeItemModel; if (themeItemModel != null) { if (themeModel.HideDefaultItems) { themeItemModel.Visibility = themeItemModel.IsDefault ? Visibility.Collapsed : Visibility.Visible; } else { themeItemModel.Visibility = Visibility.Visible; } } else { ThemeItemCategoryModel itemCategoryModel = item as ThemeItemCategoryModel; if (itemCategoryModel == null) { return; } foreach (ThemeTreeItem themeTreeItem in (Collection <ThemeTreeItem>)itemCategoryModel.Children) { ThemeModel.UpdateVisibility(themeModel, themeTreeItem); } if (Enumerable.FirstOrDefault <ThemeTreeItem>((IEnumerable <ThemeTreeItem>)itemCategoryModel.Children, (Func <ThemeTreeItem, bool>)(o => o.Visibility != Visibility.Collapsed)) == null) { itemCategoryModel.Visibility = Visibility.Collapsed; } else { itemCategoryModel.Visibility = Visibility.Visible; } } }
public void UpdateVisibility() { ThemeModel.UpdateVisibility(this, (ThemeTreeItem)this); }