public void InitSelectedAndIco(TreeViewImgItem item, int itemsCount) { if (itemsCount == 0) { SetChildItemIco(item); item.Selected += (sender, e) => ChildItemSelected?.Invoke((TreeViewItem)sender, e); } else { SetParentItemIco(item); item.Selected += (sender, e) => ParentItemSelected?.Invoke((TreeViewItem)sender, e); } }
private void Init() { var navBarGroupsList = _barGroupsManage.GetAll().ToList(); navBarGroupsList.ForEach(a => { var treeView = new CTreeView(a.Id, LeftMenusList) { BorderThickness = new Thickness(0) }; treeView.ChildItemSelected += (sender, e) => ChildItemSelected?.Invoke(sender, e); treeView.ParentItemSelected += (sender, e) => ParentItemSelected?.Invoke(sender, e); var navBarGroup = new NavBarGroup { DisplayMode = DisplayMode.ImageAndText, Header = a.Name, ImageSource = GetNavBarGroupImageSource(a.Ico), DataContext = a }; navBarGroup.Activate += (sender, e) => NavBarGroupActivate?.Invoke(sender, e); navBarGroup.Items.Add(treeView); NavBarControlMain.Groups.Add(navBarGroup); }); }