Window Event VisibleChanged not firing

0 Answers 222 Views
Window
Hendrik
Top achievements
Rank 2
Bronze
Iron
Iron
Hendrik asked on 12 Jan 2024, 10:48 AM

I want to use the VisibleChanged-Event but it is only firing, if the User closes the Window through "CloseOnOverlayClick"

A click on an Action-Button or setting the isVisible-Property to false does not work.

Here is my Code:


    <TelerikWindow Class="window-dialog" Centered="true" Visible="@isVisible" VisibleChanged="@VisibleChangedHandler" Modal="true" CloseOnOverlayClick="true">

        <WindowTitle>
            <strong>Log-In</strong>
        </WindowTitle>

        <WindowActions>
            <WindowAction Name="Close" OnClick="@(()=>isVisible=false)" />
        </WindowActions>

...

 


Dimo
Telerik team
commented on 12 Jan 2024, 11:40 AM

@Hendrik - I don't observe such а behavior: https://blazorrepl.telerik.com/meEPPGbb36wgTebg36

Please send a similar runnable test page for inspection.

 
Hendrik
Top achievements
Rank 2
Bronze
Iron
Iron
commented on 13 Jan 2024, 11:53 AM

Here is a sample project. I saw that the sample is running on your webside but it does not work in a real project.

The project is based on the newest Web-App-Template (.NET 8) and everything is made by the book refering to your documentation.

Dimo
Telerik team
commented on 15 Jan 2024, 03:23 PM

@Hendrik - sorry about the misunderstanding. I understood the opposite from what you said.

VisibleChanged does not fire when clicking on the Close WindowAction, because it has an OnClick handler, which replaces the built-in behavior with custom logic. If you want the VisibleChanged event to fire for the action button, then remove the OnClick handler, which does not seem to be necessary anyway.

Other than that, the provided project works as expected:

  • VisibleChanged fires when clicking on the modal overlay.
  • VisibleChanged does not fire when clicking on the button inside the Window content, because the button closes the Window programmatically. Our components fire events that result from user behavior, and not from programmatic algorithms.
Hendrik
Top achievements
Rank 2
Bronze
Iron
Iron
commented on 15 Jan 2024, 05:23 PM

Thank you. That was helpful.

No answers yet. Maybe you can help?

Tags
Window
Asked by
Hendrik
Top achievements
Rank 2
Bronze
Iron
Iron
Share this question
or