protected virtual void Expand() { var endState = !IsExpanded; //foreach (var ele in this.Siblings) // ele.IsExpanded = false; //Walk down the tree expanding anything nested one layer deep //this can be removed when we have the hierachy implemented properly if (Items.Count == 1 && SubCategories.Any()) { var subElement = SubCategories[0]; while (subElement.Items.Count == 1) { subElement.IsExpanded = true; if (subElement.SubCategories.Any()) { subElement = subElement.SubCategories[0]; } else { break; } } subElement.IsExpanded = true; } IsExpanded = endState; }
protected virtual void Expand() { var endState = !IsExpanded; foreach (var ele in SubCategories.Where(cat => cat.IsExpanded)) { ele.IsExpanded = false; } //Walk down the tree expanding anything nested one layer deep //this can be removed when we have the hierachy implemented properly if (Items.Count == 1 && SubCategories.Any()) { var subElement = SubCategories[0]; while (subElement.Items.Count == 1) { subElement.IsExpanded = true; if (subElement.SubCategories.Any()) { subElement = subElement.SubCategories[0]; } else { break; } } subElement.IsExpanded = true; } IsExpanded = endState; if (TreeViewItems != null) { //ClassDetails.IsExpanded = IsExpanded; TreeViewItems[0].IsExpanded = IsExpanded; } OnRequestReturnFocusToSearch(); }
private void Back() { switch (Mode) { case ArticleSelectorModes.ArticleSelection: //// If an article is selected, reset quantity and unselect article //if (SelectedArticle != null) //{ // SelectedArticle = null; // Quantity = 1; //} //// Else, go up to subcategory or category //else //{ // if no subcategories, back to category selection if (SubCategories.Any()) { SelectedSubCategory = null; Mode = ArticleSelectorModes.SubCategorySelection; } else { SelectedCategory = null; Mode = ArticleSelectorModes.CategorySelection; } //} break; case ArticleSelectorModes.SubCategorySelection: SelectedCategory = null; Mode = ArticleSelectorModes.CategorySelection; break; default: throw new InvalidOperationException($"Cannot use back button in mode {Mode}"); } RaisePropertyChanged(() => CurrentlyDisplayedCollection); }
private void SelectCategoryOrSubCategory(string categoryOrSubCategory) { if (Mode == ArticleSelectorModes.CategorySelection) { SelectedCategory = categoryOrSubCategory; // if no subcategories, direct article selection if (SubCategories.Any()) { Mode = ArticleSelectorModes.SubCategorySelection; } else { Mode = ArticleSelectorModes.ArticleSelection; } } else if (Mode == ArticleSelectorModes.SubCategorySelection) { Mode = ArticleSelectorModes.ArticleSelection; SelectedSubCategory = categoryOrSubCategory; } RaisePropertyChanged(() => CurrentSelectionPath); RaisePropertyChanged(() => CurrentlyDisplayedCollection); }
public override bool CanDelete() { return(!Components.Any() && !SubCategories.Any()); }