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/mJbvlMEV17noCYuv21.
Hello everyone,
I updated the REPL link in the original post to: https://blazorrepl.telerik.com/mJbvlMEV17noCYuv21
The previous one was too old and no longer compatible with the current Telerik UI for Blazor API (e.g. how icons are defined).
Regards,
Dimo
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
We want to know how the window is closed because all our apps are 100% useable with keyboard.
Using a mouse is optional.
Escape is the general: Close this window without saving
But when a TelerikWindow is closed, I need to consume the Escape key so the parent-window does not receive the 'Escape' too and closes too.
So that is why I need to know if Escape is used to close the window or the X or the ClickInOverlay. So I can consume the Escape when the parentpage wants to close too. Just a simple "CloseOnEscape" like "CloseOnOverlayClick" would be sufficient so you can setup your own Escape handler for the TelerikWindow.
I have managed to do so using all kind of quirks but a "CloseOnEscape" would be very usefull I guess.
Next to this, the repl does not work:
https://blazorrepl.telerik.com/GcaqOxkT13mCiQ4q33.
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/.