@@ -19,6 +19,7 @@ public sealed partial class ShellPanesPage : Page, IShellPanesPage, ITabBarItemC
19
19
// Dependency injections
20
20
21
21
private IGeneralSettingsService GeneralSettingsService { get ; } = Ioc . Default . GetRequiredService < IGeneralSettingsService > ( ) ;
22
+ private ILayoutSettingsService LayoutSettingsService { get ; } = Ioc . Default . GetRequiredService < ILayoutSettingsService > ( ) ;
22
23
private AppModel AppModel { get ; } = Ioc . Default . GetRequiredService < AppModel > ( ) ;
23
24
24
25
// Constants
@@ -357,13 +358,10 @@ public void FocusOtherPane()
357
358
}
358
359
359
360
/// <inheritdoc/>
360
- public void UpdatePanesLayout ( bool inlcudeActive = true )
361
+ public void UpdatePanesLayout ( )
361
362
{
362
- if ( GetPane ( 0 ) is IShellPage leftPane && ( inlcudeActive || leftPane != ActivePane ) )
363
- UpdatePaneLayout ( leftPane ) ;
364
-
365
- if ( GetPane ( 1 ) is IShellPage rightPane && ( inlcudeActive || rightPane != ActivePane ) )
366
- UpdatePaneLayout ( rightPane ) ;
363
+ foreach ( var pane in GetPanes ( ) )
364
+ UpdatePaneLayout ( pane ) ;
367
365
}
368
366
369
367
// Private methods
@@ -469,6 +467,9 @@ RootGrid.ColumnDefinitions.Count is 0
469
467
// Focus
470
468
ActivePane = GetPane ( GetPaneCount ( ) - 1 ) ;
471
469
470
+ UnHookLayoutUpdateRequiredEvent ( ) ;
471
+ HookLayoutUpdateRequiredEvent ( ) ;
472
+
472
473
NotifyPropertyChanged ( nameof ( IsMultiPaneActive ) ) ;
473
474
}
474
475
@@ -533,6 +534,7 @@ private void RemovePane(int index = -1)
533
534
}
534
535
535
536
Pane_ContentChanged ( null , null ! ) ;
537
+ UnHookLayoutUpdateRequiredEvent ( ) ;
536
538
NotifyPropertyChanged ( nameof ( IsMultiPaneActive ) ) ;
537
539
}
538
540
@@ -562,6 +564,18 @@ private void SetShadow()
562
564
}
563
565
}
564
566
567
+ private void HookLayoutUpdateRequiredEvent ( )
568
+ {
569
+ foreach ( var pane in GetPanes ( ) )
570
+ pane . FolderSettings . LayoutPreferencesUpdateRequired += FolderSettings_LayoutPreferencesUpdateRequired ;
571
+ }
572
+
573
+ private void UnHookLayoutUpdateRequiredEvent ( )
574
+ {
575
+ foreach ( var pane in GetPanes ( ) )
576
+ pane . FolderSettings . LayoutPreferencesUpdateRequired -= FolderSettings_LayoutPreferencesUpdateRequired ;
577
+ }
578
+
565
579
// Override methods
566
580
567
581
protected override void OnNavigatedTo ( NavigationEventArgs eventArgs )
@@ -740,6 +754,24 @@ private void Sizer_ManipulationCompleted(object sender, ManipulationCompletedRou
740
754
this . ChangeCursor ( InputSystemCursor . Create ( InputSystemCursorShape . Arrow ) ) ;
741
755
}
742
756
757
+ private void FolderSettings_LayoutPreferencesUpdateRequired ( object ? sender , LayoutPreferenceEventArgs e )
758
+ {
759
+ var currentPath = ActivePane ? . TabBarItemParameter ? . NavigationParameter as string ;
760
+ if ( string . IsNullOrEmpty ( currentPath ) )
761
+ return ;
762
+
763
+ foreach ( var pane in GetPanes ( ) )
764
+ {
765
+ if ( pane != ActivePane &&
766
+ ( LayoutSettingsService . SyncFolderPreferencesAcrossDirectories ||
767
+ pane . TabBarItemParameter ? . NavigationParameter is string path &&
768
+ path . Equals ( currentPath , StringComparison . OrdinalIgnoreCase ) ) )
769
+ {
770
+ UpdatePaneLayout ( pane ) ;
771
+ }
772
+ }
773
+ }
774
+
743
775
private void NotifyPropertyChanged ( [ CallerMemberName ] string propertyName = "" )
744
776
{
745
777
PropertyChanged ? . Invoke ( this , new PropertyChangedEventArgs ( propertyName ) ) ;
@@ -759,6 +791,7 @@ public void Dispose()
759
791
pane . GotFocus -= Pane_GotFocus ;
760
792
pane . RightTapped -= Pane_RightTapped ;
761
793
pane . PointerPressed -= Pane_PointerPressed ;
794
+ pane . FolderSettings . LayoutPreferencesUpdateRequired -= FolderSettings_LayoutPreferencesUpdateRequired ;
762
795
pane . Dispose ( ) ;
763
796
}
764
797
0 commit comments