void gridView2_ShowFilterPopupListBox(object sender, FilterPopupListBoxEventArgs e) { if (e.Column.FieldName == "DefaultValue") { Dictionary <string, List <object> > values = new Dictionary <string, List <object> >(); DevExpress.XtraEditors.Controls.ComboBoxItemCollection col = new DevExpress.XtraEditors.Controls.ComboBoxItemCollection(new DevExpress.XtraEditors.Repository.RepositoryItemComboBox()); foreach (FilterItem it in e.ComboBox.Items) { if (!it.Text.StartsWith("(")) { string t = it.Text; if (t.StartsWith("Value")) { t = NumericEditor.GetDisplayText(t, true, Plugin); } if (!values.ContainsKey(t)) { values.Add(t, new List <object>()); } values[t].Add("[DefaultValue] = '" + it.Value + "'"); } } foreach (string t in values.Keys) { DevExpress.XtraGrid.Columns.ColumnFilterInfo cfi = new DevExpress.XtraGrid.Columns.ColumnFilterInfo(String.Join(" OR ", values[t]), t); col.Add(new FilterItem(t, cfi)); } e.ComboBox.Items.Clear(); e.ComboBox.Items.Add(new FilterItem("(All)", new DevExpress.XtraGrid.Columns.ColumnFilterInfo())); e.ComboBox.Items.AddRange(col); } }
private int GetBarEditItemIndex(object sender) { var i = 0; var isFind = false; if (sender is BarEditItem editItem) { DevExpress.XtraEditors.Controls.ComboBoxItemCollection items = null; if (editItem.Name.Equals(barEditItemLocalization.Name)) { items = repositoryItemLocalization.Items; } if (editItem.Name.Equals(barEditItemViewType.Name)) { items = repositoryItemViewType.Items; } if (items != null && items.Count > 0) { foreach (var item in items) { if (editItem.EditValue == item) { isFind = true; break; } i++; } } } return(isFind ? i : -1); }
public static void LoadItems(DevExpress.XtraEditors.Controls.ComboBoxItemCollection comboCollection, bool skip0 = false) { if (comboCollection != null) { if (comboCollection.Count == 0) { foreach (var item in EnumWrapper <TEnum> .EnumerateItems(skip0)) { comboCollection.Add(item.Item2); } } } }
private void SetComboboxIndex(DevExpress.XtraEditors.ComboBoxEdit control, string selectvalue) { if (control.Properties.Items != null && control.Properties.Items.Count > 0) { DevExpress.XtraEditors.Controls.ComboBoxItemCollection cbSelectItems = control.Properties.Items; for (int i = 0; i < cbSelectItems.Count; i++) { if (cbSelectItems[i].ToString() == selectvalue) { control.SelectedIndex = i; } } } }
private void chineseComboEdit(Control ctrl) { DevExpress.XtraEditors.ComboBoxEdit newc = new DevExpress.XtraEditors.ComboBoxEdit(); newc.Name = ctrl.Name + "clone"; ctrl.Parent.Controls.Add(newc); newc.Location = ctrl.Location; newc.Size = ctrl.Size; ctrl.Visible = false; newc.Tag = ctrl; newc.Visible = true; DevExpress.XtraEditors.Controls.ComboBoxItemCollection coll = newc.Properties.Items; foreach (DictionaryEntry de in filterDic) { coll.Add(de.Key); } newc.SelectedIndex = (ctrl as DevExpress.XtraEditors.ComboBoxEdit).SelectedIndex; newc.SelectedIndexChanged += new System.EventHandler(SelectedIndexChanged); }