From 8478ba7fa56d39a3bde4825489210b3674b51d33 Mon Sep 17 00:00:00 2001 From: Marco Gavelli Date: Fri, 9 Sep 2022 22:27:20 +0200 Subject: [PATCH 1/2] Workaround for win10 titlebar drag --- src/Files.App/Views/MainPage.xaml.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Files.App/Views/MainPage.xaml.cs b/src/Files.App/Views/MainPage.xaml.cs index a1818549983c..f61f641ed626 100644 --- a/src/Files.App/Views/MainPage.xaml.cs +++ b/src/Files.App/Views/MainPage.xaml.cs @@ -134,7 +134,18 @@ private void UserSettingsService_OnSettingChangedEvent(object sender, SettingCha private void HorizontalMultitaskingControl_Loaded(object sender, RoutedEventArgs e) { - horizontalMultitaskingControl.DragArea.SizeChanged += (_, _) => SetRectDragRegion(); + // WINUI3: bad workaround to be removed asap! + // SetDragRectangles() does not work on windows 10 with winappsdk "1.2.220902.1-preview1" + if (Environment.OSVersion.Version.Build >= 22000) + { + horizontalMultitaskingControl.DragArea.SizeChanged += (_, _) => SetRectDragRegion(); + } + else + { + App.Window.AppWindow.TitleBar.ExtendsContentIntoTitleBar = false; + App.Window.ExtendsContentIntoTitleBar = true; + App.Window.SetTitleBar(horizontalMultitaskingControl.DragArea); + } if (!(ViewModel.MultitaskingControl is HorizontalMultitaskingControl)) { From 252ac29025daab919ea7c7ff2334d2055583f352 Mon Sep 17 00:00:00 2001 From: Marco Gavelli Date: Fri, 9 Sep 2022 23:17:42 +0200 Subject: [PATCH 2/2] Fix spaces --- src/Files.App/Views/MainPage.xaml.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Files.App/Views/MainPage.xaml.cs b/src/Files.App/Views/MainPage.xaml.cs index f61f641ed626..e30c47270200 100644 --- a/src/Files.App/Views/MainPage.xaml.cs +++ b/src/Files.App/Views/MainPage.xaml.cs @@ -134,12 +134,12 @@ private void UserSettingsService_OnSettingChangedEvent(object sender, SettingCha private void HorizontalMultitaskingControl_Loaded(object sender, RoutedEventArgs e) { - // WINUI3: bad workaround to be removed asap! - // SetDragRectangles() does not work on windows 10 with winappsdk "1.2.220902.1-preview1" - if (Environment.OSVersion.Version.Build >= 22000) + // WINUI3: bad workaround to be removed asap! + // SetDragRectangles() does not work on windows 10 with winappsdk "1.2.220902.1-preview1" + if (Environment.OSVersion.Version.Build >= 22000) { - horizontalMultitaskingControl.DragArea.SizeChanged += (_, _) => SetRectDragRegion(); - } + horizontalMultitaskingControl.DragArea.SizeChanged += (_, _) => SetRectDragRegion(); + } else { App.Window.AppWindow.TitleBar.ExtendsContentIntoTitleBar = false;