鼠标输入WPF时的ComboBox下拉列表

时间:2016-09-08 01:56:41

标签: wpf

如何让ComboBox自动下拉,

鼠标在WPF中输入?

1 个答案:

答案 0 :(得分:0)

在WPF中,设置IsDropDownOpen属性可以做到

XAML:

    <ComboBox Name="cb" IsEditable="True"  MouseEnter="Cb_OnMouseEnter"/> 

代码:

  private void Cb_OnMouseEnter(object sender, MouseEventArgs e)
  {
      cb.IsDropDownOpen = true;
  }

-

在winform中设置DroppedDown属性。

cbo.DroppedDown = true;

通过此链接:

How to make combo box auto expand on mouse hover and close when the mouse leaves combo box in c#?