DxWindow.Shown Event
Fires after the Window is displayed.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.1.dll
NuGet Package: DevExpress.Blazor
Declaration
[Parameter]
public EventCallback<WindowShownEventArgs> Shown { get; set; }
Event Data
The Shown event's data class is WindowShownEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
CancellationToken | Specifies an object that propagates a cancellation notification. |
Remarks
Handle the Shown
event to process show actions. This event occurs in the following cases:
- You set the Visible property to
true
. - You call the ShowAsync or ShowAtAsync method.
You can also handle the Showing event that fires before the Window is displayed and allows you to cancel this action. To process close actions, handle the Closing and Closed events.
The following example allows users to show the Window only after they enable the checkbox:
The following example displays the window only after users enable the checkbox:
<div>
<DxCheckBox @bind-Checked="@Checked">
Allow Window
</DxCheckBox>
@*...*@
<DxButton RenderStyle="ButtonRenderStyle.Secondary"
Click="OnShowAtPositionClick">SHOW A WINDOW</DxButton>
</div>
<DxWindow 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)"
@ref=WindowRef
Showing="WindowShowing"
Shown="WindowShown">
</DxWindow>
@code {
DxWindow WindowRef;
bool Checked { get; set; }
bool WindowVisible { get; set; }
void WindowShowing(WindowShowingEventArgs args) {
args.Cancel = !Checked;
}
void WindowShown(WindowShownEventArgs args) {
Checked = false;
}
async Task OnShowAtPositionClick(MouseEventArgs args) {
await WindowRef.ShowAtAsync(args.ClientX, args.ClientY);
}
}