ToolStripDropDownItem.DropDownOpened Event

Definition

Occurs when the ToolStripDropDown has opened.

C#
public event EventHandler DropDownOpened;
C#
public event EventHandler? DropDownOpened;

Event Type

Examples

The following code example demonstrates how to handle the DropDownOpened event for multiple ToolStripDropDownItem controls. This code example is part of a larger example provided for the ToolStripDropDownItem class.

C#
// This method handles the DropDownOpened event from a 
// ToolStripDropDownItem. It displays the value of the 
// item's Text property in the form's StatusStrip control.
void toolStripDropDownItem_DropDownOpened(object sender, EventArgs e)
{
    ToolStripDropDownItem item = sender as ToolStripDropDownItem;

    string msg = String.Format("Item opened: {0}", item.Text);
    this.toolStripStatusLabel1.Text = msg;
}

Remarks

This event occurs when the user clicks the drop down item or when you call the ShowDropDown method. You can use this event to dynamically populate the ToolStripDropDown.

For more information about handling events, see Handling and Raising Events.

Applies to

Product Versions
.NET Framework 2.0, 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