# .NET MAUI DropDownButton Events

The .NET MAUI DropDownButton emits a set of events that allow you to configure the component's behavior in response to specific user actions.

The .NET MAUI DropDownButton exposes the following events:

* `Opening`—Raised when the `RadDropDownButton.IsOpen` property is changing to `true`. The `Opening` event handler receives two parameters:
  * The `sender` argument which is of type `RadDropDownButton`.
  * A `CancelEventArgs` object which provides an option to cancel the `Opening` event by using the `Cancel`(`bool`) property.

* `Opened`—Raised when the drop-down is fully opened, including the completion of any open animation. The `Opened` event handler receives two parameters:
  * The `sender` argument which is of type `RadDropDownButton`.
  * An `EventArgs` object which provides information about the `Opened` event.

* `Closed`—Raised when the drop-down is fully closed, including the completion of any close animation. The `Closed` event handler receives two parameters:
  * The `sender` argument which is of type `RadDropDownButton`.
  * An `EventArgs` object which provides information about the `Closed` event.

The `RadDropDownButton` inherits the `Clicked`, `Pressed`, and `Released` events from the `RadTemplatedButton`.

## Using the Opening, Opened and Closed Events

The following example demonstrates how to use the `Opening`, `Opened`, and `Closed` events.

**1.** Define the button in XAML:

```XAML
<telerik:RadDropDownButton Content="Open drop-down"
                           Opening="OnDropDownOpening"
                           Opened="OnDropDownOpened"
                           Closed="OnDropDownClosed">
    <telerik:RadDropDownButton.DropDownContent>
        <VerticalStackLayout Padding="12" Spacing="6">
            <Label Text="Actions"
                   FontAttributes="Bold" />
            <telerik:RadTemplatedButton Content="New" />
            <telerik:RadTemplatedButton Content="Open" />
            <telerik:RadTemplatedButton Content="Save" />
        </VerticalStackLayout>
    </telerik:RadDropDownButton.DropDownContent>
</telerik:RadDropDownButton>
```

**2.** Add the `telerik` namespace:

```XAML
xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"
```

**3.** Add the `Opening`, `Opened` and `Closed` event handlers:

```C#
private void OnDropDownOpening(object sender, CancelEventArgs e)
{
    if (this.cancelOpeningCheckBox?.IsChecked == true)
    {
        e.Cancel = true;
        this.AppendLog("Opening was canceled.");
        return;
    }

    this.AppendLog("Opening");
}

private void OnDropDownOpened(object sender, System.EventArgs e)
{
    this.AppendLog("Opened");
}

private void OnDropDownClosed(object sender, System.EventArgs e)
{
    this.AppendLog("Closed");
}

private void AppendLog(string message)
{
    this.eventsLog.Text = string.IsNullOrEmpty(this.eventsLog.Text)
        ? message
        : $"{this.eventsLog.Text}\n{message}";
}
```

This is the result on WinUI:

![.NET MAUI DropDownButton Events](https://www.telerik.com/maui-ui/documentation/assets/22d6d1ffc6dbe5fa3e01cc68071f6cd8/dropdownbutton-events.gif "DropDownButton for .NET MAUI")

> For a runnable example demonstrating the DropDownButton events, see the [SDKBrowser Demo Application](https://www.telerik.com/maui-ui/documentation/demos-and-sample-apps/sdkbrowser-app) and go to the **DropDownButton > Features** category.

## See Also

* [Configure the Button Content and Indicator](https://www.telerik.com/maui-ui/documentation/controls/dropdownbutton/button-configuration)
* [Configure the Drop-Down Part](https://www.telerik.com/maui-ui/documentation/controls/dropdownbutton/dropdown-configuration)
* [Style the DropDownButton](https://www.telerik.com/maui-ui/documentation/controls/dropdownbutton/styling)
* [Command](https://www.telerik.com/maui-ui/documentation/controls/dropdownbutton/command)
* [Animation](https://www.telerik.com/maui-ui/documentation/controls/dropdownbutton/animation)
