-
Current behaviorMulti-window support is a new feature in v5.2. Expected behaviorCan create a new window using a method called by MVUX command. How to reproduce it (as minimally and precisely as possible)MainPage.xaml
MainModel.cs
WorkaroundUse MVVM. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
This problem occurs because the command is executing on non-UI thread and |
Beta Was this translation helpful? Give feedback.
-
You need to get access to the dispatcher. If you are using navigation from the extensions you can simply add an eg: using Uno.Extensions;
namespace MultiWindowTestXamlMVUX;
internal partial record MainModel(IDispatcher Dispatcher)
{
public ValueTask OpenWindow(CancellelationToken ct)
=> Dispatcher.ExecuteAsync(() =>
{
var window = new Window();
window.Activate();
}, ct);
} If you are instantiating your model directly in the code behind of your page, you can simply pass the |
Beta Was this translation helpful? Give feedback.
You need to get access to the dispatcher.
If you are using navigation from the extensions you can simply add an
Uno.Extensions.IDispatcher
parameter to your constructor to get it injected by the DI.eg:
If you are instantiating your model directly in the code behind of your page, you can simply pass the
DispatcherQueue
(still in the ctor).