Skip to main content

DxDropDown.PreventCloseOnPositionTargetClick Property

Specifies whether the drop-down window should be closed when a user clicks the position target element.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public bool PreventCloseOnPositionTargetClick { get; set; }

Property Value

Type Default Description
Boolean false

false to close the drop-down window on any outside click; true to keep the drop-down window open when the position target element is clicked.

Remarks

If the CloseOnOutsideClick property is set to true, the drop-down window is closed when a user clicks outside the window’s boundaries. Set the PreventCloseOnPositionTargetClick property to true to prevent the window from closing when a user clicks an element specified by the PositionTarget property. This behavior allows you to change window visibility on a position target element click in the following way:

<div id="dropdown-overview-target-container">
    <DxButton Click="() => IsOpen = !IsOpen">SHOW A DROPDOWN</DxButton>
</div>
<DxDropDown
    @bind-IsOpen="@IsOpen"
    BodyText="@Constants.Content"
    PositionMode="DropDownPositionMode.Bottom"
    Width="max(25vw, 250px)"
    PositionTarget="#dropdown-overview-target-container"
    PreventCloseOnPositionTargetClick="true">
</DxDropDown>

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

Run Demo: DropDown — Overview

See Also