Skip to content

Commit 45aa133

Browse files
authored
Fix: Fixed an issue where the title bar drag region was sometimes missing (#16549)
1 parent 1af4f28 commit 45aa133

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

src/Files.App/UserControls/TabBar/TabBar.xaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@
260260
Grid.ColumnSpan="2"
261261
HorizontalAlignment="Stretch"
262262
VerticalAlignment="Stretch"
263-
Fill="Transparent" />
263+
Fill="Transparent"
264+
Loaded="DragAreaRectangle_Loaded" />
264265

265266
</Grid>
266267
</TabView.TabStripFooter>

src/Files.App/UserControls/TabBar/TabBar.xaml.cs

+12-10
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,6 @@ public TabBar()
6464
tabHoverTimer.Interval = TimeSpan.FromMilliseconds(Constants.DragAndDrop.HoverToOpenTimespan);
6565
tabHoverTimer.Tick += TabHoverSelected;
6666

67-
var appWindow = MainWindow.Instance.AppWindow;
68-
69-
double rightPaddingColumnWidth =
70-
FilePropertiesHelpers.FlowDirectionSettingIsRightToLeft
71-
? appWindow.TitleBar.LeftInset
72-
: appWindow.TitleBar.RightInset;
73-
74-
RightPaddingColumn.Width = new(rightPaddingColumnWidth >= 0 ? rightPaddingColumnWidth : 0);
75-
7667
AppearanceSettingsService.PropertyChanged += (s, e) =>
7768
{
7869
switch (e.PropertyName)
@@ -366,5 +357,16 @@ private void TabViewItem_Loaded(object sender, RoutedEventArgs e)
366357
});
367358
}
368359
}
360+
361+
private void DragAreaRectangle_Loaded(object sender, RoutedEventArgs e)
362+
{
363+
double scaleAdjustment = DragAreaRectangle.XamlRoot.RasterizationScale;
364+
double titleBarInset = ((FilePropertiesHelpers.FlowDirectionSettingIsRightToLeft
365+
? MainWindow.Instance.AppWindow.TitleBar.LeftInset
366+
: MainWindow.Instance.AppWindow.TitleBar.RightInset) / scaleAdjustment) + 40;
367+
368+
HorizontalTabView.Measure(new(HorizontalTabView.ActualWidth - TabBarAddNewTabButton.Width - titleBarInset, HorizontalTabView.ActualHeight));
369+
RightPaddingColumn.Width = new(titleBarInset >= 0 ? titleBarInset : 0);
370+
}
369371
}
370-
}
372+
}

src/Files.App/Views/MainPage.xaml.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -487,4 +487,4 @@ private void PaneSplitter_ManipulationStarted(object sender, ManipulationStarted
487487
InputSystemCursorShape.SizeWestEast : InputSystemCursorShape.SizeNorthSouth));
488488
}
489489
}
490-
}
490+
}

0 commit comments

Comments
 (0)