コード例 #1
0
        private void cbinput_textchanged(object sender, EventArgs e)
        {
            var    cb       = (this.cbinput as ComboBoxEntry);
            string newvalue = cb.TextEntry.Text;

            var matches = this.cbinput.Items.Cast <comboitem>().Where(_i => _i.text.StartsWith(newvalue, StringComparison.CurrentCulture)).ToArray();

            if (matches.Count() == 1 && this.item.TypeConverter.GetStandardValuesExclusive(this.item as ITypeDescriptorContext))
            {
                /*  var fullvalue = matches.First().text;
                 * if (newvalue.Length == fullvalue.Length)*/
                {
                    owner.SetValue(this.item, matches.First().value);
                    //   this.cbinput.SelectedItem =matches.First();
                }

                /* else
                 * {
                 *   cb.TextEntry.Text = fullvalue;
                 *   cb.TextEntry.SelectionStart = newvalue.Length;
                 *   cb.TextEntry.SelectionLength = fullvalue.Length-newvalue.Length;
                 * }*/
            }

            /*  else
             * {
             *    cb.TextEntry.SelectionLength = 0;
             * }*/
        }