ComboBox.DropDownClosed 事件
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
当关闭组合框的下拉列表时发生。
public:
event EventHandler ^ DropDownClosed;
public event EventHandler DropDownClosed;
member this.DropDownClosed : EventHandler
Public Custom Event DropDownClosed As EventHandler
事件类型
示例
以下示例演示如何分配事件处理程序以及如何处理 DropDownOpened 和 DropDownClosed 事件。
<ComboBox Name="cb" StaysOpenOnEdit="true" IsEditable="true" DropDownOpened="OnDropDownOpened"
DropDownClosed="OnDropDownClosed">
void OnDropDownOpened(object sender, EventArgs e)
{
if (cb.IsDropDownOpen == true)
{
cb.Text = "Combo box opened";
}
}
void OnDropDownClosed(object sender, EventArgs e)
{
if (cb.IsDropDownOpen == false)
{
cb.Text = "Combo box closed";
}
}
Private Sub OnDropDownOpened(ByVal Sender As Object, ByVal e As EventArgs)
If (cb.IsDropDownOpen = True) Then
cb.Text = "Combo box opened"
End If
End Sub
Private Sub OnDropDownClosed(ByVal Sender As Object, ByVal e As EventArgs)
If (cb.IsDropDownOpen = False) Then
cb.Text = "Combo box closed"
End If
End Sub