コード例 #1
0
        private void UpdateListMenuBoxSelectStatus(string sKey)
        {
            for (int i = 0; i < this.SpNavItems.Children.Count; i++)
            {
                ListMenuBox menuBox = this.SpNavItems.Children[i] as ListMenuBox;
                if (menuBox != null)
                {
                    if (menuBox.Items.Count == 0)
                    {
                        if (menuBox.Key == sKey)
                        {
                            menuBox.IsExpanded = true;
                        }
                        else
                        {
                            menuBox.IsExpanded = false;
                        }
                    }
                    else
                    {
                        bool bIsChildSelect = false;
                        for (int j = 0; j < menuBox.Items.Count; j++)
                        {
                            ListMenuItem menuItem = menuBox.Items[j] as ListMenuItem;
                            if (menuItem != null)
                            {
                                if (menuItem.Key != sKey)
                                {
                                    menuItem.IsSelected = false;
                                }
                                else
                                {
                                    menuItem.IsSelected = true;
                                    bIsChildSelect      = true;
                                }
                            }
                        }

                        if (!bIsChildSelect)
                        {
                            menuBox.IsExpanded = false;
                        }
                        else
                        {
                            menuBox.IsExpanded = true;
                        }
                    }
                }
            }
        }
コード例 #2
0
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            this.RectHeader.MouseDown           += RectHeader_MouseDown;
            this.MenuShutdown.MouseLeftButtonUp += MenuShutdown_MouseLeftButtonUp;

            for (int i = 0; i < this.SpNavItems.Children.Count; i++)
            {
                ListMenuBox menuBox = this.SpNavItems.Children[i] as ListMenuBox;
                if (menuBox != null)
                {
                    menuBox.OnKeySelected += MenuBox_OnKeySelected;
                }
            }

            this.MenuCloseAllNavHeader.MouseLeftButtonUp += MenuCloseAllNavHeader_MouseLeftButtonUp;
            this.MenuLeft.MouseLeftButtonUp  += MenuLeft_MouseLeftButtonUp;
            this.MenuRight.MouseLeftButtonUp += MenuRight_MouseLeftButtonUp;
            this.UpdateNavHeaderStatus();
        }
コード例 #3
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;
                }
            }
        }
コード例 #4
0
        private void UpdateListMenuBoxSelectStatus(string sKey)
        {
            // Xaml 示例模块
            for (int i = 0; i < this.SpNavItems.Children.Count; i++)
            {
                ListMenuBox menuBox = this.SpNavItems.Children[i] as ListMenuBox;
                if (menuBox != null)
                {
                    if (menuBox.Items.Count == 0)
                    {
                        if (menuBox.Key == sKey)
                        {
                            menuBox.IsExpanded = true;
                        }
                        else
                        {
                            menuBox.IsExpanded = false;
                        }
                    }
                    else
                    {
                        bool bIsChildSelect = false;
                        for (int j = 0; j < menuBox.Items.Count; j++)
                        {
                            ListMenuItem menuItem = menuBox.Items[j] as ListMenuItem;
                            if (menuItem != null)
                            {
                                if (menuItem.Key != sKey)
                                {
                                    menuItem.IsSelected = false;
                                }
                                else
                                {
                                    menuItem.IsSelected = true;
                                    bIsChildSelect      = true;
                                }
                            }
                        }

                        if (!bIsChildSelect)
                        {
                            menuBox.IsExpanded = false;
                        }
                        else
                        {
                            menuBox.IsExpanded = true;
                        }
                    }
                }
            }

            // Binding示例模块
            bool bIsItemSelect = false;
            ObservableCollection <CatalogOfEffect> ltItems = this.LmxBinding.ItemsSource as ObservableCollection <CatalogOfEffect>;

            if (ltItems != null && ltItems.Count > 0)
            {
                for (int i = 0; i < ltItems.Count; i++)
                {
                    if (ltItems[i].Key != sKey)
                    {
                        ltItems[i].IsSelected = false;
                    }
                    else
                    {
                        ltItems[i].IsSelected = true;
                        bIsItemSelect         = true;
                    }
                }
                if (!bIsItemSelect)
                {
                    this.LmxBinding.IsExpanded = false;
                }
                else
                {
                    this.LmxBinding.IsExpanded = true;
                }
            }
        }
コード例 #5
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();
            //    }
            //}

            //// 取消绑定示例的选中状态
            //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;
            //}
            this.CancelSelectStatus(sender);
            this.GetMenuContentPage(sText, sKey);

            //// 创建界面
            //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);
            //}
        }
コード例 #6
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);
            }
        }
コード例 #7
0
 private void MenuBox_OnKeySelected(ListMenuBox sender, string sText, string sKey)
 {
     this.CancelSelectStatus(sender);
     this.GetMenuContentPage(sText, sKey);
 }