@@ -30,8 +30,6 @@ public sealed partial class TabBar : BaseTabBar, INotifyPropertyChanged
3030
3131 private bool _lockDropOperation = false ;
3232
33- private static int _gap = 40 ;
34-
3533 // Starting position when dragging a tab
3634 private System . Drawing . Point dragStartPoint ;
3735
@@ -55,14 +53,6 @@ public bool AllowTabsDrag
5553 public Rectangle DragArea
5654 => DragAreaRectangle ;
5755
58- private GridLength _titleBarWidth ;
59-
60- public GridLength TitleBarWidth
61- {
62- get => _titleBarWidth ;
63- set => _titleBarWidth = new ( ( value . Value / App . AppModel . AppWindowDPI ) + _gap ) ;
64- }
65-
6656 // Events
6757
6858 public static event EventHandler < TabBarItem ? > ? SelectedTabItemChanged ;
@@ -76,11 +66,6 @@ public TabBar()
7666 tabHoverTimer . Interval = TimeSpan . FromMilliseconds ( Constants . DragAndDrop . HoverToOpenTimespan ) ;
7767 tabHoverTimer . Tick += TabHoverSelected ;
7868
79- var appWindow = MainWindow . Instance . AppWindow ;
80- TitleBarWidth = new ( FilePropertiesHelpers . FlowDirectionSettingIsRightToLeft
81- ? appWindow ! . TitleBar . LeftInset
82- : appWindow ! . TitleBar . RightInset ) ;
83-
8469 AppearanceSettingsService . PropertyChanged += ( s , e ) =>
8570 {
8671 switch ( e . PropertyName )
@@ -377,10 +362,24 @@ private void TabViewItem_Loaded(object sender, RoutedEventArgs e)
377362
378363 private void DragAreaRectangle_Loaded ( object sender , RoutedEventArgs e )
379364 {
380- if ( HorizontalTabView . ActualWidth > 0 && TabBarAddNewTabButton . Width > 0 && TitleBarWidth . Value > 0 )
365+ if ( HorizontalTabView . ActualWidth > 0 && TabBarAddNewTabButton . Width > 0 )
381366 {
382- HorizontalTabView . Measure ( new ( HorizontalTabView . ActualWidth - TabBarAddNewTabButton . Width - TitleBarWidth . Value , HorizontalTabView . ActualHeight ) ) ;
383- return ;
367+ var appWindow = MainWindow . Instance . AppWindow ;
368+ var titleBarInset = ( FilePropertiesHelpers . FlowDirectionSettingIsRightToLeft
369+ ? appWindow . TitleBar . LeftInset
370+ : appWindow . TitleBar . RightInset ) / DragAreaRectangle . XamlRoot . RasterizationScale ;
371+
372+ if ( titleBarInset > 0 )
373+ {
374+ titleBarInset += 40 ; // Add 40px gap
375+ RightPaddingColumn . Width = new ( titleBarInset ) ;
376+
377+ HorizontalTabView . Measure ( new (
378+ HorizontalTabView . ActualWidth - TabBarAddNewTabButton . Width - titleBarInset ,
379+ HorizontalTabView . ActualHeight ) ) ;
380+
381+ return ;
382+ }
384383 }
385384
386385 DispatcherQueue . TryEnqueue ( ( ) => DragAreaRectangle_Loaded ( sender , e ) ) ;
0 commit comments