Unplanned
Last Updated: 03 Jun 2022 05:26 by ADMIN
MichaƂ
Created on: 25 Nov 2021 13:40
Category: Window
Type: Feature Request
9
Cancelable OnClose event

I would like to have an event that fires when the user closes the Window and to be able to cancel the event. I would like to have an identifier if the user pressed the "Esc" key or the Close button rendered in the Browser.

---

ADMIN EDIT

---

At the time of writing, only using the VisibleChanged event can let you prevent the Window from closing. As a workaround, you can cancel this event and use a custom close command that will not trigger it to, effectively, disable closing with Esc: https://blazorrepl.telerik.com/GcaqOxkT13mCiQ4q33.

2 comments
ADMIN
Nadezhda Tacheva
Posted on: 03 Jun 2022 05:26

Hi Daniel,

Thank you for sharing your solution with the community!

Meanwhile, in the admin edit of the opening post I added another option that you and other interested parties may try.

Regards,
Nadezhda Tacheva
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Daniel
Posted on: 30 May 2022 22:31
A current workaround, you can have an empty component implement IDisposable within the Window and when the Dispose function is called, trigger a callback passed in as a parameter to the component.