Exemplo n.º 1
0
        private void CancelSelectStatus(ListMenuBox sender)
        {
            // 取消其他ListMenuBox的选中状态
            for (int i = 0; i < this.SpNavItems.Children.Count; i++)
            {
                ListMenuBox menuBox = this.SpNavItems.Children[i] as ListMenuBox;
                if (menuBox != null && menuBox != sender)
                {
                    menuBox.CancelSelectAll();
                }
            }

            // 取消绑定示例的选中状态
            ObservableCollection <CatalogOfEffect> ltItems = this.LmxBinding.ItemsSource as ObservableCollection <CatalogOfEffect>;

            if (ltItems != null && ltItems.Count > 0)
            {
                for (int i = 0; i < ltItems.Count; i++)
                {
                    ltItems[i].IsSelected = false;
                }
            }
        }
Exemplo n.º 2
0
        private void MenuBox_OnKeySelected(ListMenuBox sender, string sText, string sKey)
        {
            // 取消其他ListMenuBox的选中状态
            for (int i = 0; i < this.SpNavItems.Children.Count; i++)
            {
                ListMenuBox menuBox = this.SpNavItems.Children[i] as ListMenuBox;
                if (menuBox != null && menuBox != sender)
                {
                    menuBox.CancelSelectAll();
                }
            }

            // 创建界面
            if (this.HsPages == null)
            {
                this.HsPages = new Hashtable();
            }

            this.GdContent.Children.Clear();
            if (this.HsPages.Contains(sKey))
            {
                // Focus To NavHeader
                for (int i = 0; i < this.SpNavHeaders.Children.Count; i++)
                {
                    NavHeader navHeader = this.SpNavHeaders.Children[i] as NavHeader;
                    if (navHeader != null)
                    {
                        if (navHeader.Key != sKey)
                        {
                            navHeader.IsSelected = false;
                        }
                        else
                        {
                            navHeader.IsSelected = true;
                        }
                    }
                }

                // Move NavHeader Container keep current navheader visible
                this.UpdateNavHeaderStatus();

                BaseModuleView moduleView = this.HsPages[sKey] as BaseModuleView;
                if (moduleView != null)
                {
                    this.GdContent.Children.Add(moduleView);
                }
            }
            else
            {
                // 取消顶部导览按钮选中状态
                for (int i = 0; i < this.SpNavHeaders.Children.Count; i++)
                {
                    NavHeader navHeader = this.SpNavHeaders.Children[i] as NavHeader;
                    if (navHeader != null)
                    {
                        navHeader.IsSelected = false;
                    }
                }

                // 创建顶部导览按钮
                NavHeader newNavHeader = new NavHeader();
                newNavHeader.Text            = sText;
                newNavHeader.Key             = sKey;
                newNavHeader.OnClosed       += NewNavHeader_OnClosed;
                newNavHeader.OnMidMouseDown += NewNavHeader_OnClosed;
                newNavHeader.OnFocused      += NewNavHeader_OnFocused;
                newNavHeader.IsSelected      = true;
                this.SpNavHeaders.Children.Add(newNavHeader);


                this.UpdateNavHeaderStatus();

                // 创建内容面板
                BaseModuleView moduleView = this.CreateContentView(sKey);
                this.GdContent.Children.Clear();
                this.GdContent.Children.Add(moduleView);
                this.HsPages.Add(sKey, moduleView);
            }
        }