diff --git a/src/Files.App/Helpers/FilePropertiesHelpers.cs b/src/Files.App/Helpers/FilePropertiesHelpers.cs index 1857e7d15940..a901baae5aea 100644 --- a/src/Files.App/Helpers/FilePropertiesHelpers.cs +++ b/src/Files.App/Helpers/FilePropertiesHelpers.cs @@ -85,7 +85,10 @@ public static async Task OpenPropertiesWindowAsync(object item, IShellPage assoc appWindow.SetIcon(LogoPath); if (frame.Content is Views.Properties.MainPropertiesPage properties) + { + properties.Window = propertiesWindow; properties.AppWindow = appWindow; + } appWindow.Show(); diff --git a/src/Files.App/Views/Properties/MainPropertiesPage.xaml.cs b/src/Files.App/Views/Properties/MainPropertiesPage.xaml.cs index 4cb8c2c1ceb6..c481acb13012 100644 --- a/src/Files.App/Views/Properties/MainPropertiesPage.xaml.cs +++ b/src/Files.App/Views/Properties/MainPropertiesPage.xaml.cs @@ -40,6 +40,7 @@ public sealed partial class MainPropertiesPage : Page public SettingsViewModel AppSettings => App.AppSettings; + public Window Window; public AppWindow AppWindow; public ObservableCollection NavViewItems { get; set; } @@ -308,7 +309,8 @@ private void Page_KeyDown(object sender, KeyRoutedEventArgs e) private void ClosePage() { if (_usingWinUI) - AppWindow.Destroy(); + // AppWindow.Destroy() doesn't seem to work well. (#11461) + Window.Close(); else _propertiesDialog?.Hide(); } diff --git a/src/Files.App/Views/Properties/SecurityAdvancedPage.xaml.cs b/src/Files.App/Views/Properties/SecurityAdvancedPage.xaml.cs index 7b08a06d399d..7f45303c40a5 100644 --- a/src/Files.App/Views/Properties/SecurityAdvancedPage.xaml.cs +++ b/src/Files.App/Views/Properties/SecurityAdvancedPage.xaml.cs @@ -28,6 +28,7 @@ public sealed partial class SecurityAdvancedPage : Page public SecurityViewModel ViewModel { get; set; } + public Window window; public AppWindow appWindow; public SecurityAdvancedPage() @@ -125,7 +126,8 @@ private async void OKButton_Click(object sender, RoutedEventArgs e) { if (ViewModel.SetFilePermissions()) { - appWindow.Destroy(); + // AppWindow.Destroy() doesn't seem to work well. (#11461) + window.Close(); } } else @@ -137,7 +139,8 @@ private async void CancelButton_Click(object sender, RoutedEventArgs e) { if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) { - appWindow.Destroy(); + // AppWindow.Destroy() doesn't seem to work well. (#11461) + window.Close(); } else { @@ -150,7 +153,8 @@ private async void Page_KeyDown(object sender, KeyRoutedEventArgs e) { if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) { - appWindow.Destroy(); + // AppWindow.Destroy() doesn't seem to work well. (#11461) + window.Close(); } else { @@ -183,4 +187,4 @@ private void ListView_SelectionChanged(object sender, SelectionChangedEventArgs } } } -} \ No newline at end of file +} diff --git a/src/Files.App/Views/Properties/SecurityPage.xaml.cs b/src/Files.App/Views/Properties/SecurityPage.xaml.cs index ecfff47d4d1f..507421d3e29e 100644 --- a/src/Files.App/Views/Properties/SecurityPage.xaml.cs +++ b/src/Files.App/Views/Properties/SecurityPage.xaml.cs @@ -101,7 +101,10 @@ private void OpenAdvancedProperties() // Set content propertiesWindow.Content = frame; if (frame.Content is SecurityAdvancedPage properties) + { + properties.window = propertiesWindow; properties.appWindow = appWindow; + } // Set min size propertiesWindow.MinWidth = 850;