private static void UpdateState(CheckBoxMenuItemCollection menuItems, CheckBoxMenuItemState state) { if (state.Vector.Count > 0) { UpdateState(menuItems, 0, state); } }
private static void GetPanelItems(int column, CheckBoxPanel panel, CheckBoxMenuItemCollection menuItems, IList <IList <CheckBoxPanel> > columnPanels) { for (var index = 0; index < menuItems.Count; ++index) { // Add a panel item for each menu item. var menuItem = menuItems[index]; var tag = CreateTag(panel.Tag, index); panel.PanelItems.Add(new CheckBoxPanelItem(tag, menuItem)); // If this menu item has children, then create a new panel for it in the next column. if (menuItem.ChildMenuItems.Count > 0) { var childPanel = new CheckBoxPanel(menuItem.Text, tag); GetPanels(columnPanels, column + 1).Add(childPanel); GetPanelItems(column + 1, childPanel, menuItem.ChildMenuItems, columnPanels); } } }
private string GetMenuPanelId(string value, CheckBoxMenuItemCollection menuItems, string parentTag) { for (var index = 0; index < menuItems.Count; ++index) { var menuItem = menuItems[index]; var tag = CreateTag(parentTag, index); if (menuItem.Value == value) { return(GetPanelClientId(tag)); } // Iterate. var id = GetMenuPanelId(value, menuItems[index].ChildMenuItems, tag); if (!string.IsNullOrEmpty(id)) { return(id); } } return(null); }
private static void UpdateState(CheckBoxMenuItemCollection menuItems, int index, CheckBoxMenuItemState state) { var coordinate = state.Vector[index]; if (coordinate >= menuItems.Count) { return; } var menuItem = menuItems[coordinate]; if (index == state.Vector.Count - 1) { // Reached the end so set it. menuItem.Checked = state.Checked; } else { // Keep going. UpdateState(menuItem.ChildMenuItems, index + 1, state); } }