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);
            }
        }
Ejemplo n.º 2
0
 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);
             }
         }
     }
 }
Ejemplo n.º 3
0
 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);
 }