@@ -126,9 +126,7 @@ private void UserSettingsService_OnSettingChangedEvent(object? sender, SettingCh
126126
127127 private void HorizontalMultitaskingControl_Loaded ( object sender , RoutedEventArgs e )
128128 {
129- TabControl . DragArea . SizeChanged += ( _ , _ ) => MainWindow . Instance . RaiseSetTitleBarDragRegion ( TabControl . SetTitleBarDragRegion ) ;
130- TabControl . SizeChanged += ( _ , _ ) => MainWindow . Instance . RaiseSetTitleBarDragRegion ( TabControl . SetTitleBarDragRegion ) ;
131-
129+ TabControl . DragArea . SizeChanged += ( _ , _ ) => MainWindow . Instance . RaiseSetTitleBarDragRegion ( SetTitleBarDragRegion ) ;
132130 if ( ViewModel . MultitaskingControl is not TabBar )
133131 {
134132 ViewModel . MultitaskingControl = TabControl ;
@@ -137,6 +135,13 @@ private void HorizontalMultitaskingControl_Loaded(object sender, RoutedEventArgs
137135 }
138136 }
139137
138+ private int SetTitleBarDragRegion ( InputNonClientPointerSource source , SizeInt32 size , double scaleFactor , Func < UIElement , RectInt32 ? , RectInt32 > getScaledRect )
139+ {
140+ var height = ( int ) TabControl . ActualHeight ;
141+ source . SetRegionRects ( NonClientRegionKind . Passthrough , [ getScaledRect ( this , new RectInt32 ( 0 , 0 , ( int ) ( TabControl . ActualWidth + TabControl . Margin . Left - TabControl . DragArea . ActualWidth ) , height ) ) ] ) ;
142+ return height ;
143+ }
144+
140145 public async void TabItemContent_ContentChanged ( object ? sender , TabBarItemParameter e )
141146 {
142147 if ( SidebarAdaptiveViewModel . PaneHolder is null )
@@ -274,7 +279,7 @@ protected override void OnLostFocus(RoutedEventArgs e)
274279
275280 private void Page_Loaded ( object sender , RoutedEventArgs e )
276281 {
277- MainWindow . Instance . AppWindow . Changed += ( _ , _ ) => MainWindow . Instance . RaiseSetTitleBarDragRegion ( TabControl . SetTitleBarDragRegion ) ;
282+ MainWindow . Instance . AppWindow . Changed += ( _ , _ ) => MainWindow . Instance . RaiseSetTitleBarDragRegion ( SetTitleBarDragRegion ) ;
278283
279284 // Defers the status bar loading until after the page has loaded to improve startup perf
280285 FindName ( nameof ( StatusBar ) ) ;
@@ -482,4 +487,4 @@ private void PaneSplitter_ManipulationStarted(object sender, ManipulationStarted
482487 InputSystemCursorShape . SizeWestEast : InputSystemCursorShape . SizeNorthSouth ) ) ;
483488 }
484489 }
485- }
490+ }
0 commit comments