Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxDropDown.Closed Event

Fires after the drop-down window is closed.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[Parameter]
public EventCallback<DropDownClosedEventArgs> Closed { get; set; }

#Event Data

The Closed event's data class is DropDownClosedEventArgs. The following properties provide information specific to this event:

Property Description
CancellationToken Specifies an object that propagates a cancellation notification.

#Remarks

Handle the Closed event to process close actions. This event occurs in the following cases:

  • A user closes the drop-down window: clicks outside the window boundaries or presses Escape.
  • You set the IsOpen property to false.
  • You call the CloseAsync method.
  • The window is closed in a custom way (the CloseCallback is called from any template).

Handle the Closing event to perform actions before the drop-down window is closed.

In the following example, the custom “OK“ button sends a close callback. On the server, this action is canceled until a user selects the checkbox in the footer. However, users can close the window in other ways: they can press Escape or click outside the window’s boundaries.

Razor
<DxButton Id="showDDbtton" Click="() => IsOpen = true">Show Window</DxButton>
<DxDropDown Width="400"
            @bind-IsOpen="@IsOpen"
            FooterVisible="true"
            HeaderText="DevExpress EULA"
            Closing="EulaClosing"
            Closed="EulaClosed">
        <BodyTextTemplate>
            <p> 
                The terms of our license are fully outlined/described in the Developer Express Inc End User
                License Agreement (EULA) included with our product installations. Before you can install and use
                a Developer Express Inc product, you must read, understand and accept the terms/conditions of
                our EULAs. <a target="" _blank"" rel="" noopener noreferrer"" href=""https: //www.devexpress.com/support/eulas/"">More info...</a>
            </p>
        </BodyTextTemplate>
    <FooterContentTemplate>
        <DxCheckBox style="margin-left: 0; margin-right: auto;" @bind-Checked="@EulaAccepted">
            I accept the terms of the EULA
        </DxCheckBox>
        <DxButton RenderStyle="ButtonRenderStyle.Primary" Text="OK" Click="context.CloseCallback" />
    </FooterContentTemplate>
</DxDropDown>

@code {
    bool IsOpen { get; set; } = false;
    bool EulaAccepted { get; set; }

    void EulaClosing(DropDownClosingEventArgs args) {
        if (args.CloseReason == DropDownCloseReason.Programmatically) {
            args.Cancel = !EulaAccepted;
        }
    }
    void EulaClosed(DropDownClosedEventArgs args) {
        EulaAccepted = false;
    }
}
See Also