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.v24.1.dll
NuGet Package: DevExpress.Blazor
Declaration
[Parameter]
public bool PreventCloseOnPositionTargetClick { get; set; }
Property Value
Type | Default | Description |
---|---|---|
Boolean | false |
|
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;
}