Прочитај на енглеском Уреди

Делите путем


ComboBox.DropDownOpened Event

Definition

Occurs when the drop-down list of the combo box opens.

C#
public event EventHandler DropDownOpened;

Event Type

Examples

The following example shows how to assign event handlers and handle the DropDownOpened and DropDownClosed events.

XAML
<ComboBox Name="cb" StaysOpenOnEdit="true" IsEditable="true" DropDownOpened="OnDropDownOpened" 
        DropDownClosed="OnDropDownClosed">
C#
void OnDropDownOpened(object sender, EventArgs e)
{
    if (cb.IsDropDownOpen)
    {
        cb.Text = "Combo box opened";
    }
}

void OnDropDownClosed(object sender, EventArgs e)
{
    if (!cb.IsDropDownOpen)
    {
        cb.Text = "Combo box closed";
    }
}

Applies to

Производ Верзије
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10