private void CreateControls(IList<QueryGroupItem> groupItems) { this.layoutControlContainer.BeginUpdate(); try { this.layoutControlGroupMain.Clear(); foreach (var groupItem in groupItems) { var combo = new CheckedComboBoxEdit {Name = "checkedCombo" + groupItems.IndexOf(groupItem)}; combo.Properties.SelectAllItemVisible = true; combo.Properties.SelectAllItemCaption = "Выбрать все"; combo.Properties.DropDownRows = 10; combo.Properties.DisplayMember = "Key"; combo.Properties.ValueMember = "Value"; combo.Properties.DataSource = groupItem.QueryDictionary.ToList(); EventHandler popupHandler = null; popupHandler = (sender, args) => { var popupContainer = (PopupContainerForm) ((IPopupControl) sender).PopupWindow; _listBoxQueries = popupContainer.Controls[3].Controls[0] as CheckedListBoxControl; if (_listBoxQueries == null) return; _listBoxQueries.ItemCheck += (o, eventArgs) => { combo.Text = string.Join("; ", _listBoxQueries.CheckedIndices.OfType<int>().Select(t => _listBoxQueries.GetItemText(t))); ListBoxQueriesOnItemCheck(o, eventArgs); }; combo.Popup -= popupHandler; }; combo.Popup += popupHandler; combo.Closed += (sender, args) => { combo.Text = string.Join("; ", _listBoxQueries.CheckedIndices.OfType<int>().Select(t => _listBoxQueries.GetItemText(t))); }; var layoutItem = new LayoutControlItem() { Text = groupItem.Head, TextLocation = Locations.Top, Control = combo }; layoutItem.AppearanceItemCaption.Font = new Font("Segoe UI", 9); this.layoutControlGroupMain.Add(layoutItem); } if (_queryListOthers.Any()) { var checkAllBox = new CheckEdit { CheckState = CheckState.Unchecked, Text = "Выбрать все" }; checkAllBox.Properties.AllowGrayed = true; checkAllBox.CheckedChanged += (sender, args) => { if (checkAllBox.Checked) { _listBoxOtherQueries.CheckAll(); } else { _listBoxOtherQueries.UnCheckAll(); } }; _listBoxOtherQueries = new CheckedListBoxControl { DisplayMember = "title", ValueMember = null, DataSource = _queryListOthers, Name = "listBoxOtherQueries", CheckOnClick = true, AutoSizeInLayoutControl = true //MinimumSize = new Size(0, 200) }; _listBoxOtherQueries.ItemCheck += (sender, args) => { if (_listBoxOtherQueries.CheckedItemsCount < _listBoxOtherQueries.ItemCount) checkAllBox.CheckState = CheckState.Indeterminate; else if (_listBoxOtherQueries.CheckedItemsCount == 0) checkAllBox.CheckState = CheckState.Unchecked; else checkAllBox.CheckState = CheckState.Checked; ListBoxQueriesOnItemCheck(sender, args); }; var layoutItem = new LayoutControlItem() { Text = "Остальные запросы", TextLocation = Locations.Top, Control = _listBoxOtherQueries }; layoutItem.AppearanceItemCaption.Font = new Font("Segoe UI", 9); this.layoutControlGroupMain.Add(layoutItem); this.layoutControlGroupMain.AddItem(new LayoutControlItem() { TextVisible = false, Control = checkAllBox }); } } finally { this.layoutControlContainer.EndUpdate(); } }