diff --git a/src/Files.App/UserControls/TabBar/TabBar.xaml b/src/Files.App/UserControls/TabBar/TabBar.xaml index 33f8fdc41b03..dc361d1470fd 100644 --- a/src/Files.App/UserControls/TabBar/TabBar.xaml +++ b/src/Files.App/UserControls/TabBar/TabBar.xaml @@ -260,7 +260,8 @@ Grid.ColumnSpan="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" - Fill="Transparent" /> + Fill="Transparent" + Loaded="DragAreaRectangle_Loaded" /> diff --git a/src/Files.App/UserControls/TabBar/TabBar.xaml.cs b/src/Files.App/UserControls/TabBar/TabBar.xaml.cs index 9ce963a44fff..249103dda4a0 100644 --- a/src/Files.App/UserControls/TabBar/TabBar.xaml.cs +++ b/src/Files.App/UserControls/TabBar/TabBar.xaml.cs @@ -64,15 +64,6 @@ public TabBar() tabHoverTimer.Interval = TimeSpan.FromMilliseconds(Constants.DragAndDrop.HoverToOpenTimespan); tabHoverTimer.Tick += TabHoverSelected; - var appWindow = MainWindow.Instance.AppWindow; - - double rightPaddingColumnWidth = - FilePropertiesHelpers.FlowDirectionSettingIsRightToLeft - ? appWindow.TitleBar.LeftInset - : appWindow.TitleBar.RightInset; - - RightPaddingColumn.Width = new(rightPaddingColumnWidth >= 0 ? rightPaddingColumnWidth : 0); - AppearanceSettingsService.PropertyChanged += (s, e) => { switch (e.PropertyName) @@ -366,5 +357,16 @@ private void TabViewItem_Loaded(object sender, RoutedEventArgs e) }); } } + + private void DragAreaRectangle_Loaded(object sender, RoutedEventArgs e) + { + double scaleAdjustment = DragAreaRectangle.XamlRoot.RasterizationScale; + double titleBarInset = ((FilePropertiesHelpers.FlowDirectionSettingIsRightToLeft + ? MainWindow.Instance.AppWindow.TitleBar.LeftInset + : MainWindow.Instance.AppWindow.TitleBar.RightInset) / scaleAdjustment) + 40; + + HorizontalTabView.Measure(new(HorizontalTabView.ActualWidth - TabBarAddNewTabButton.Width - titleBarInset, HorizontalTabView.ActualHeight)); + RightPaddingColumn.Width = new(titleBarInset >= 0 ? titleBarInset : 0); + } } -} +} \ No newline at end of file diff --git a/src/Files.App/Views/MainPage.xaml.cs b/src/Files.App/Views/MainPage.xaml.cs index 81d6f68c4d7b..a98ef622795b 100644 --- a/src/Files.App/Views/MainPage.xaml.cs +++ b/src/Files.App/Views/MainPage.xaml.cs @@ -487,4 +487,4 @@ private void PaneSplitter_ManipulationStarted(object sender, ManipulationStarted InputSystemCursorShape.SizeWestEast : InputSystemCursorShape.SizeNorthSouth)); } } -} +} \ No newline at end of file