DxDropDown.FocusOnOpen Property
Specifies whether the drop-down window receives focus when it opens. Available in v25.2.6+.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v25.2.dll
NuGet Package: DevExpress.Blazor
Declaration
[DefaultValue(true)]
[Parameter]
public bool FocusOnOpen { get; set; }
Property Value
| Type | Default | Description |
|---|---|---|
| Boolean | true |
|
Remarks
When FocusOnOpen is true, focus moves to the first interactive element in the drop-down window when it opens.
If you set this property to false, focus stays on the currently focused element.
Note
Users can press Esc to close the drop-down regardless of the FocusOnOpen value.
The following code snippet keeps focus on the trigger button when the drop-down window opens:
<DxButton Id="dropdownButton"
Text="Open a drop-down window"
Click="() => isOpen = true" />
<DxDropDown @bind-IsOpen="isOpen"
PositionTarget="#dropdownButton"
PositionMode="DropDownPositionMode.Bottom"
Width="250px"
BodyText="Are you sure you want to continue?"
FooterVisible="true"
FocusOnOpen="false">
<FooterContentTemplate>
<DxButton Text="Yes" Click="@context.CloseCallback" />
</FooterContentTemplate>
</DxDropDown>
@code {
bool isOpen { get; set; } = false;
}
See Also