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"); } }
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); }
public CategoryItemViewModel(CategoryNode categoryNode) : this(categoryNode, null) { }