Skip to main content

DxDropDown.Shown Event

Fires after the drop-down window is displayed.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public EventCallback<DropDownShownEventArgs> Shown { get; set; }

Event Data

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

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

Remarks

Handle the Shown event to process show actions. This event occurs in the following cases:

You can handle the Showing event that fires before the drop-down window is displayed and allows you to cancel this action. To process close actions, handle the Closing and Closed events.

The following example allows users to display the drop-down window only after they enable the checkbox:

Blazor DropDown Show Events

<div>
    <DxCheckBox @bind-Checked="@Checked">Allow Drop-Down Window</DxCheckBox>
    <DxButton Id="button" RenderStyle="ButtonRenderStyle.Primary" Text="Show" Click="() => IsOpen = true" />
</div>

<DxDropDown @bind-IsOpen="@IsOpen"
            HeaderText="Header"
            BodyText="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris sit amet metus vel
             nisi blandit tincidunt vel efficitur purus."
            Width="400"
            PositionTarget="#button"
            PositionMode="DropDownPositionMode.Bottom"
            Showing="WindowShowing"
            Shown="WindowShown">
</DxDropDown>
@code {
    bool Checked { get; set; }
    bool IsOpen { get; set; }

    void WindowShowing(DropDownShowingEventArgs args) {
        args.Cancel = !Checked;
    }
    void WindowShown(DropDownShownEventArgs args) {
        Checked = false;
    }
}
See Also