Skip to main content

DxDropDown.CloseOnOutsideClick Property

Specifies whether the drop-down window should be closed when a user clicks outside the window’s boundaries.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[DefaultValue(true)]
[Parameter]
public bool CloseOnOutsideClick { get; set; }

Property Value

Type Default Description
Boolean true

true to close the drop-down window in response to a click outside the element; otherwise, false.

Remarks

Users can close a drop-down window in the following ways:

  • Press Escape.
  • Click outside the window’s boundaries.

Set the CloseOnOutsideClick property to false to keep the drop-down window open in response to a click outside the element.

<DxButton Id="showDDbtton" Click="() => IsOpenWindow = true">Show Window</DxButton>
<DxDropDown @bind-IsOpen="@IsOpenWindow"
            PositionTarget="#showDDbtton"
            PositionMode="DropDownPositionMode.Bottom"
            CloseOnOutsideClick="false"
            FooterVisible="true"
            BodyText="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
            incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
            exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."
            Width="400" >
    <FooterContentTemplate>
        @* In a template, you can use the context.CloseCallback property 
           to implement a custom close action. *@
        <DxButton Text="OK" Click="@context.CloseCallback" />
    </FooterContentTemplate>
</DxDropDown>

@code {
    bool IsOpenWindow { get; set; } = false;
}
See Also