private void menuItem_Click(object sender, EventArgs e) { this.panelBar.BeginUpdate(); this.panelBar.SuspendLayout(); RadAssociatedMenuItem item = sender as RadAssociatedMenuItem; if (item.IsChecked) { BoxLayout layout = new BoxLayout(); this.panelBar.Items.Insert(0, item.group); this.panelBar.Items.Owner = layout; this.panelBar.hiddenGroupsList.Remove(item.group); if (item.group.Visibility == ElementVisibility.Collapsed) { InsertToggleButton(item.group); } } else { this.panelBar.Items.Remove(item.group); item.group.Items.Owner = item.group.verticalLayout; this.panelBar.hiddenGroupsList.Add(item.group); RemoveToggleButton(item.group); } this.panelBar.SetStyle(); this.panelBar.EndUpdate(); this.panelBar.ResumeLayout(true); }
private void InitializeOverFlowDropDownButton() { this.showMoreButtonsMenuItem = new RadMenuItem(); this.showMoreButtonsMenuItem.Text = "Show More Buttons"; this.showMoreButtonsMenuItem.Enabled = false; this.showMoreButtonsMenuItem.Click += new EventHandler(item_Click); this.SetImageToItem(this.showMoreButtonsMenuItem, "arrowUp.gif"); if (this.panelBarOverFlow.Items.Count > 0) { this.showMoreButtonsMenuItem.Enabled = true; } this.showFewerButtonsMenuItem = new RadMenuItem(); this.showFewerButtonsMenuItem.Text = "Show Fewer Buttons"; this.showFewerButtonsMenuItem.Click += new EventHandler(item2_Click); this.SetImageToItem(this.showFewerButtonsMenuItem, "arrowDown.gif"); if (this.panelBarOverFlow.Items.Count == this.panelBar.Items.Count) { this.showFewerButtonsMenuItem.Enabled = false; } this.navigationPaneOptions = new RadMenuItem(); this.navigationPaneOptions.Text = "Navigation Pane Options"; this.navigationPaneOptions.Click += new EventHandler(navigationPaneOptions_Click); this.AddOrRemoveButtons = new RadMenuItem(); this.AddOrRemoveButtons.Text = "Add or Remove Buttons"; this.panelBarOverFlow.DropDownButton.Items.Add(this.showMoreButtonsMenuItem); this.panelBarOverFlow.DropDownButton.Items.Add(this.showFewerButtonsMenuItem); this.panelBarOverFlow.DropDownButton.Items.Add(this.navigationPaneOptions); this.panelBarOverFlow.DropDownButton.Items.Add(this.AddOrRemoveButtons); foreach (RadPanelBarGroupElement group in this.panelBar.Items) { RadAssociatedMenuItem menuItem = new RadAssociatedMenuItem(group); menuItem.Text = group.Caption; menuItem.IsChecked = true; menuItem.Image = (group.horizontalLayout.Children[0] as RadPanelBarVisualElement).Image; this.AddOrRemoveButtons.Items.Add(menuItem); menuItem.CheckOnClick = true; menuItem.Click += new EventHandler(menuItem_Click); } foreach (RadPanelBarGroupElement group in this.panelBar.hiddenGroupsList) { RadAssociatedMenuItem menuItem = new RadAssociatedMenuItem(group); menuItem.Text = group.Caption; menuItem.IsChecked = false; menuItem.Image = (group.horizontalLayout.Children[0] as RadPanelBarVisualElement).Image; this.AddOrRemoveButtons.Items.Add(menuItem); menuItem.CheckOnClick = true; menuItem.Click += new EventHandler(menuItem_Click); } }