From 429d1d47f6dc61e922dfc948a1bd4a25e0b97389 Mon Sep 17 00:00:00 2001 From: punker76 Date: Sat, 5 Nov 2022 14:26:07 +0100 Subject: [PATCH] fix: #131 add dialog to panel even if IsOpen already set to true --- src/Directory.build.props | 2 +- src/MahApps.Metro.SimpleChildWindow/ChildWindowManager.cs | 6 ++++-- .../MahApps.Metro.SimpleChildWindow.csproj | 8 ++------ 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Directory.build.props b/src/Directory.build.props index ec341e2..6b65a01 100644 --- a/src/Directory.build.props +++ b/src/Directory.build.props @@ -5,7 +5,7 @@ true false true - 8.0 + 9 true full $(NoWarn);CS1591 diff --git a/src/MahApps.Metro.SimpleChildWindow/ChildWindowManager.cs b/src/MahApps.Metro.SimpleChildWindow/ChildWindowManager.cs index 44d31de..58940e3 100644 --- a/src/MahApps.Metro.SimpleChildWindow/ChildWindowManager.cs +++ b/src/MahApps.Metro.SimpleChildWindow/ChildWindowManager.cs @@ -139,9 +139,11 @@ public static async Task ShowChildWindowAsync(this Control con private static async Task OpenDialogAsync(ChildWindow dialog, Panel container, TaskCompletionSource tcs) { - if (!dialog.IsOpen) + var hasParent = dialog.TryFindParent() is not null; + + if (!dialog.IsOpen || !hasParent) { - if (dialog.TryFindParent() is null) + if (!hasParent) { container.Children.Add(dialog); } diff --git a/src/MahApps.Metro.SimpleChildWindow/MahApps.Metro.SimpleChildWindow.csproj b/src/MahApps.Metro.SimpleChildWindow/MahApps.Metro.SimpleChildWindow.csproj index 6fbe6b0..32871ae 100644 --- a/src/MahApps.Metro.SimpleChildWindow/MahApps.Metro.SimpleChildWindow.csproj +++ b/src/MahApps.Metro.SimpleChildWindow/MahApps.Metro.SimpleChildWindow.csproj @@ -18,11 +18,7 @@ - - + + \ No newline at end of file