Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 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);
 }
Ejemplo n.º 5
0
 public override bool CanDelete()
 {
     return(!Components.Any() && !SubCategories.Any());
 }