Unplanned
Last Updated: 24 Jan 2023 14:28 by ADMIN
Nico
Created on: 21 Dec 2022 13:58
Category: UI for .NET MAUI
Type: Bug Report
0
Popup: [WinUI] Stays open in async operations when IsOpen is set to false

Popup:

Calling

IsOpen = true,
IsOpen = false,
IsOpen = true,
IsOpen = false,

while the last IsOpen update isn't ready, kills the Popup.
It works async, even if animations are set to none/0s and there is no public event to validate the last update is fully done (Popup opened/closed)

In my case i have a popup opened, while a search operation is running in the background.
If this background search returns too fast and i set IsOpen to false, the update is ignored and the popup keeps in an opened state.

4 comments
ADMIN
Didi
Posted on: 24 Jan 2023 14:28

Hello Nico,

We have verified this is a bug in the Popup control on WinUI. the status of the item is changed to "Unplanned".

As a workaround use Displather.DispatchDelayed:

private async void OnFailingClicked(object sender, EventArgs e)
    {
        popup.IsOpen = true;
        await Task.Run(() => Task.CompletedTask);    
this.Dispatcher.DispatchDelayed(TimeSpan.FromMilliseconds(20), () =>         {              popup.IsOpen = false;        
});    
}

Regards,
Didi
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/.

ADMIN
Didi
Posted on: 09 Jan 2023 08:53

Hello Nico,

Thank you for the provided projects. I will review them to check whether the behavior described is a bug in the popup control. The first project shows two states, in the first -  there is a delay and the popup is closed as expected after the delay. The second case uses Task.Completed, then popup isOpen is set to false, but the control does not closed. 

We need to carefully research Task.Complete, before approving this bug report. The status of the item will be updated accordingly. 

Regards,
Didi
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/.

Nico
Posted on: 02 Jan 2023 09:09

Hello Didi,

use your documentation demo:

popup.IsOpen = true;
await Task.Run(() => Task.CompletedTask)
popup.IsOpen = false;

 

or take the examples attached

kind regards
Nico

ADMIN
Didi
Posted on: 27 Dec 2022 07:31

Hello Nico,

The described behavior seems like a timing issue. Have your tied using a Dispatcher? The popup is in another visual tree. Could you please share whether the property in the ViewModel you use as a binding to the Popup.IsOpen has a PropertyChanged

If you can send us a sample demo with the exact scenario that will be of great help.

Regards,
Didi
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/.