コード例 #1
0
        private void SelectCategory()
        {
            var isIn = _categoryNodes.FirstOrDefault(s => s.Id == _treeViewSelectedCategoryNode.Id);

            if (isIn == null)
            {
                AddProductCategoryMappingToDbContext();

                CategoryNode cn = new CategoryNode
                {
                    Id = _treeViewSelectedCategoryNode.Id, Name = _treeViewSelectedCategoryNode.Name
                };

                _categoryNodes.Add(cn);
                _categoryListSelectedItem = cn;
                RaisePropertyChanged("CategoryNodesList");
                RaisePropertyChanged("CategoryListSelectedItem");
            }
        }
コード例 #2
0
        public List <CategoryNode> GetChildNode(CategoryNode node)
        {
            List <CategoryNode> nList = new List <CategoryNode>();

            var nodes = from category in categoryList
                        where category.ParentCategoryId == node.Id
                        select new CategoryNode {
                Name = category.Name, Id = category.Id
            };

            nList = nodes.ToList();

            foreach (CategoryNode cNode in nList)
            {
                cNode.Children = GetChildNode(cNode);
            }

            return(nList);
        }
コード例 #3
0
 public CategoryItemViewModel(CategoryNode categoryNode)
     : this(categoryNode, null)
 {
 }