Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="type"></param>
        public EnumCellEditor(Type type)
        {
            this.DropDownStyle = ComboBoxStyle.DropDownList;
            this.ValueMember   = "Key";

            ArrayList values = new ArrayList();

            foreach (object value in Enum.GetValues(type))
            {
                values.Add(new ComboBoxItem(value, Enum.GetName(type, value)));
            }

            this.DataSource = values;

            ControlUtilities.AutoResizeDropDown(this);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create an AutoCompleteCellEditor
        /// </summary>
        /// <param name="lv"></param>
        /// <param name="column"></param>
        public AutoCompleteCellEditor(ObjectListView lv, OLVColumn column)
        {
            this.DropDownStyle = ComboBoxStyle.DropDown;

            Dictionary <String, bool> alreadySeen = new Dictionary <string, bool>();

            for (int i = 0; i < Math.Min(lv.GetItemCount(), 1000); i++)
            {
                String str = column.GetStringValue(lv.GetModelObject(i));
                if (!alreadySeen.ContainsKey(str))
                {
                    this.Items.Add(str);
                    alreadySeen[str] = true;
                }
            }

            this.Sorted             = true;
            this.AutoCompleteSource = AutoCompleteSource.ListItems;
            this.AutoCompleteMode   = AutoCompleteMode.Append;

            ControlUtilities.AutoResizeDropDown(this);
        }