diff --git a/e2e/Uno/HelloWorld/Views/Shell.xaml b/e2e/Uno/HelloWorld/Views/Shell.xaml
index 0b84db3bc1..ba86753f26 100644
--- a/e2e/Uno/HelloWorld/Views/Shell.xaml
+++ b/e2e/Uno/HelloWorld/Views/Shell.xaml
@@ -2,10 +2,8 @@
x:Class="HelloWorld.Views.Shell"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:pr="using:Prism.Navigation.Regions"
- xmlns:pvm="using:Prism.Mvvm"
+ xmlns:prism="using:Prism.Navigation.Regions"
xmlns:toolkit="using:Uno.Toolkit.UI"
- pvm:ViewModelLocator.AutowireViewModel="true"
xmlns:local="using:HelloWorld.Views"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" >
@@ -48,8 +46,8 @@
- -->
- -->
+
diff --git a/src/Uno/Prism.Uno/Dialogs/DialogService.cs b/src/Uno/Prism.Uno/Dialogs/DialogService.cs
index 67e159b98c..851137da50 100644
--- a/src/Uno/Prism.Uno/Dialogs/DialogService.cs
+++ b/src/Uno/Prism.Uno/Dialogs/DialogService.cs
@@ -23,14 +23,18 @@ public async void ShowDialog(string name, IDialogParameters parameters, DialogCa
parameters ??= new DialogParameters();
var windowName = parameters.TryGetValue(KnownDialogParameters.WindowName, out var wName) ? wName : null;
- IDialogWindow contentDialog = CreateDialogWindow(windowName);
- ConfigureDialogWindowEvents(contentDialog, callback);
- ConfigureDialogWindowContent(name, contentDialog, parameters);
+ var dialogWindow = CreateDialogWindow(windowName);
+ if (dialogWindow is ContentDialog contentDialog)
+ {
+ contentDialog.XamlRoot = _containerProvider.Resolve().Content.XamlRoot;
+ }
+ ConfigureDialogWindowEvents(dialogWindow, callback);
+ ConfigureDialogWindowContent(name, dialogWindow, parameters);
var placement = parameters.ContainsKey(KnownDialogParameters.DialogPlacement) ?
(parameters[KnownDialogParameters.DialogPlacement] is ContentDialogPlacement placementValue ? placementValue : Enum.Parse(parameters[KnownDialogParameters.DialogPlacement].ToString() ?? string.Empty)) : ContentDialogPlacement.Popup;
- await contentDialog.ShowAsync(placement);
+ await dialogWindow.ShowAsync(placement);
}
catch (Exception ex)
{
diff --git a/src/Uno/Prism.Uno/Dialogs/DialogWindow.xaml.cs b/src/Uno/Prism.Uno/Dialogs/DialogWindow.xaml.cs
index f4720965ee..938b3c9e3f 100644
--- a/src/Uno/Prism.Uno/Dialogs/DialogWindow.xaml.cs
+++ b/src/Uno/Prism.Uno/Dialogs/DialogWindow.xaml.cs
@@ -10,10 +10,9 @@ namespace Prism.Dialogs
///
public partial class DialogWindow : ContentDialog, IDialogWindow
{
- public DialogWindow(Window window)
+ public DialogWindow()
{
this.InitializeComponent();
- XamlRoot = window.Content.XamlRoot;
}
public IDialogResult? Result { get; set; }
diff --git a/tests/Prism.Core.Tests/Commands/AsyncDelegateCommandFixture.cs b/tests/Prism.Core.Tests/Commands/AsyncDelegateCommandFixture.cs
index da4a5ad2d7..3db702283b 100644
--- a/tests/Prism.Core.Tests/Commands/AsyncDelegateCommandFixture.cs
+++ b/tests/Prism.Core.Tests/Commands/AsyncDelegateCommandFixture.cs
@@ -97,7 +97,12 @@ public async Task ExecuteAsync_WithCancellationToken_ShouldExecuteCommandAsynchr
// Arrange
bool executionStarted = false;
bool executed = false;
- var command = new AsyncDelegateCommand(Execute);
+ bool taskCancelled = false;
+ var command = new AsyncDelegateCommand(Execute)
+ .Catch(ex =>
+ {
+ taskCancelled = true;
+ });
async Task Execute(CancellationToken token)
{
@@ -116,6 +121,7 @@ async Task Execute(CancellationToken token)
// Assert
Assert.True(executionStarted);
Assert.False(executed);
+ Assert.True(taskCancelled);
}
[Fact]