Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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

C#
[DefaultValue(true)]
[Parameter]
public bool CloseOnEscape { get; set; }

#Property Value

Type Default Description
Boolean true

trueto close the Window when a user presses Escape; otherwise; false

#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 to false to disable this capability. The following code snippet demonstrates this.
Razor
<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