DxWindow.CloseOnEscape Property
Specifies whether the Window should close when a user presses Escape.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.2.dll
NuGet Package: DevExpress.Blazor
Declaration
[DefaultValue(true)]
[Parameter]
public bool CloseOnEscape { get; set; }
Property Value
Type | Default | Description |
---|---|---|
Boolean | true |
|
Remarks
Users can close the Window in the following ways:
- Click the Close button. Set the ShowCloseButton to
true
to show this button. - Press Escape. You can set the
CloseOnEscape
property tofalse
to disable this capability. The following code snippet demonstrates this.
<DxButton RenderStyle="ButtonRenderStyle.Secondary"
Click="() => WindowVisible = !WindowVisible">SHOW A WINDOW</DxButton>
<DxWindow @bind-Visible=WindowVisible
HeaderText="Header"
BodyText="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris sit amet metus vel
nisi blandit tincidunt vel efficitur purus. Nunc nec turpis tempus, accumsan orci auctor,
imperdiet mauris. Fusce id purus magna."
Width="max(25vw, 250px)"
ShowCloseButton="true"
CloseOnEscape=false>
</DxWindow>
@code {
bool WindowVisible { get; set; } = false;
}
You can also use the following templates to implement a custom close action: HeaderTemplate, BodyTemplate, FooterTemplate. In a template, use the context
parameter’s CloseCallback property.
See Also