Exemple #1
0
        /// <summary>
        /// 初始化 LeftMenu
        /// </summary>
        private void InitLeftMenu()
        {
            var allLeftMenus = _leftMenusManage.GetAll();

            _leftMenu = new LeftMenu(allLeftMenus);
            // 给每个组的根目录添加“根节点”选择
            _leftMenu.NavBarControlMain.Groups.ForEach(a =>
            {
                var leftMenusModel = new LeftMenus
                {
                    DisplayName   = Config.RootDisplayName,
                    NavBarGroupId = ((NavBarGroups)a.DataContext).Id
                };
                var treeViewItem = new TreeViewImgItem
                {
                    DataContext = leftMenusModel,
                    HeaderText  = leftMenusModel.DisplayName,
                };
                ((CTreeView)a.Items[0]).Items.Insert(0, treeViewItem);
                treeViewItem.Selected += LeftMenu_RootItemSelected;
            });

            _leftMenu.ParentItemSelected += LeftMenu_ParentItemSelected;
            _leftMenu.ChildItemSelected  += LeftMenu_ChildItemSelected;
            GridLeftMenu.Children.Add(_leftMenu);
        }
        /// <summary>
        /// 初始化 NavBarGroups
        /// </summary>
        private void InitLeftMenu()
        {
            var allLeftMenus = _leftMenusManage.GetAll();

            _leftMenu = new LeftMenu(allLeftMenus);
            GridNavBarGroup.Children.Add(_leftMenu);
            _leftMenu.NavBarGroupActivate += LeftMenu_OnNavBarGroupActivate;

            var nav = _leftMenu.NavBarControlMain.ActiveGroup?.DataContext as NavBarGroups;

            if (nav != null)
            {
                InitActiveGroupRightData(nav);
            }
        }