【问题标题】:Auto Complete works for only the first character typed自动完成仅适用于输入的第一个字符
【发布时间】:2018-10-25 20:21:39
【问题描述】:

我正在使用 Telerik Raddropdownlist 并已将自动完成模式设置为建议。当我在文本框中键入第一个字符时,例如“1”,下拉列表会建议所有以 1 开头的项目,这很好(假设 match1 之后列出的前 2 个项目是 1234 和 1456)。但是,当我输入另一个“1”时,文本框会附加“111234”,这基本上是我输入的 1 以及下拉列表中的第一个元素。虽然自动完成模式是建议而不是建议附加,但我不知道为什么要附加第一个匹配项。

  this.radDropDownList1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
            this.radDropDownList1.AutoSizeItems = true;
            this.radDropDownList1.DefaultItemsCountInDropDown = 20;
            this.radDropDownList1.DropDownHeight = 160;
            this.radDropDownList1.DropDownMinSize = new System.Drawing.Size(400, 200);
            this.radDropDownList1.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F);
            this.radDropDownList1.Location = new System.Drawing.Point(803, 23);
            this.radDropDownList1.MaxDropDownItems = 10;
            this.radDropDownList1.Name = "radDropDownList1"; 
            this.radDropDownList1.RootElement.AutoSize = false;
            this.radDropDownList1.Size = new System.Drawing.Size(280, 36);
            this.radDropDownList1.TabIndex = 2;
            this.radDropDownList1.Text = "Select Project";
            this.radDropDownList1.DropDownListElement.AutoCompleteSuggest.DropDownList.Popup.Font = new System.Drawing.Font("Microsoft Sans Serif", 16);
            this.radDropDownList1.SelectedIndexChanged += new Telerik.WinControls.UI.Data.PositionChangedEventHandler(this.raddropdownlist_SelectedIndexChanged);






  radDropDownList1.DataSource = ditems;
                radDropDownList1.DisplayMember = "ProjectName";
                radDropDownList1.ValueMember = "ProjectName";
                radDropDownList1.AutoCompleteDataSource = ditems;
                radDropDownList1.AutoCompleteMode = AutoCompleteMode.Suggest;
                Size popupSize = new Size(400, 300);
                radDropDownList1.DropDownListElement.AutoCompleteSuggest.DropDownList.DropDownMinSize = popupSize;
                radDropDownList1.DropDownListElement.DropDownMinSize = popupSize;
                radDropDownList1.ListElement.Font = new Font("Microsoft Sans Serif",16);
                radDropDownList1.DropDownListElement.AutoCompleteSuggest.DropDownList.Popup.Font = new System.Drawing.Font("Microsoft Sans Serif", 16);



            }
            catch (Exception ex)
            {
                Utils.LogManager.write("Exception occur While populating Projects. error detail: " + ex.Message + "\r\nStacktrace: " + ex.StackTrace, "error");
                ExceptionDialog.ShowExceptionDialog(ex);
            }

            radDropDownList1.SelectedIndex = -1;
            radDropDownList1.Text = "Select Project";




 private void raddropdownlist_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e)
        {
            if (radDropDownList1.SelectedIndex >=0)
            {
                cbTaskList.Select();
                PopulateTasks();

                if (this.GetMainForm().IsResetApp)
                {
                    return;
                }
            }
        }

我知道我的代码中有很多冗余,但我很难调整 AutoSuggest 弹出窗口的大小,而且我也是新手。

【问题讨论】:

    标签: c# wpf winforms telerik


    【解决方案1】:
     radDropDownList1.DropDownListElement.AutoCompleteSuggest.DropDownList.Popup.Font = new System.Drawing.Font("Microsoft Sans Serif", 16);
    

    导致它表现得很奇怪。一旦我将其注释掉,它就可以正常工作。

    【讨论】:

      猜你喜欢
      • 2012-10-11
      • 2011-11-07
      • 1970-01-01
      • 1970-01-01
      • 2021-06-23
      • 1970-01-01
      • 2017-09-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多