Repository: files-community/Files
File: src/Files.App/Data/Contexts/DisplayPage/DisplayPageContext.cs (C#)

Code before:
				if (FolderSettings is LayoutPreferencesManager viewModel)
					viewModel.SortDirectoriesAlongsideFiles = value;
			}
		}

		private bool _SortFilesFirst = false;
		public bool SortFilesFirst
		{
			get => _SortFilesFirst;
			set
			{
				if (FolderSettings is LayoutPreferencesManager viewModel)
					viewModel.SortFilesFirst = value;
			}
		}

		private LayoutPreferencesManager? FolderSettings => context.ActivePaneOrColumn?.InstanceViewModel?.FolderSettings;

		public DisplayPageContext()
		{
			context.ActivePaneChanging += Context_Changing;
			context.ActivePaneChanged += Context_Changed;
			layoutSettingsService.PropertyChanged += Settings_PropertyChanged;
		}

		public void UpdateAllTabsAndPanesLayout()
		{
			var multitaskingContext = Ioc.Default.GetRequiredService<IMultitaskingContext>();
			var tabs = multitaskingContext.Control?.GetAllTabInstances();
			var activePath = ((ShellPanesPage)multitaskingContext.CurrentTabItem.TabItemContent)?.ActivePane?.TabBarItemParameter?.NavigationParameter as string;
			if (tabs is null || activePath is null)
				return;

			for (int i = 0; i < tabs.Count; i++)
			{
				((ShellPanesPage)tabs[i]).UpdatePanesLayout(activePath, i != multitaskingContext.CurrentTabIndex);
			}
		}

		private void Context_Changing(object? sender, EventArgs e)
		{
			var viewModel = FolderSettings;
			if (viewModel is not null)
				viewModel.PropertyChanged -= FolderSettings_PropertyChanged;
			Update();
		}
		private void Context_Changed(object? sender, EventArgs e)
		{
			var viewModel = FolderSettings;
			if (viewModel is not null)
				viewModel.PropertyChanged += FolderSettings_PropertyChanged;

Review comment (suggestion):
```suggestion
		public void UpdateOpenTabsPreferences()
```

Code after:
				if (FolderSettings is LayoutPreferencesManager viewModel)
					viewModel.SortDirectoriesAlongsideFiles = value;
			}
		}

		private bool _SortFilesFirst = false;
		public bool SortFilesFirst
		{
			get => _SortFilesFirst;
			set
			{
				if (FolderSettings is LayoutPreferencesManager viewModel)
					viewModel.SortFilesFirst = value;
			}
		}

		private LayoutPreferencesManager? FolderSettings => context.ActivePaneOrColumn?.InstanceViewModel?.FolderSettings;

		public DisplayPageContext()
		{
			context.ActivePaneChanging += Context_Changing;
			context.ActivePaneChanged += Context_Changed;
			layoutSettingsService.PropertyChanged += Settings_PropertyChanged;
		}

		private void Context_Changing(object? sender, EventArgs e)
		{
			var viewModel = FolderSettings;
			if (viewModel is not null)
				viewModel.PropertyChanged -= FolderSettings_PropertyChanged;
			Update();
		}
		private void Context_Changed(object? sender, EventArgs e)
		{
			var viewModel = FolderSettings;
			if (viewModel is not null)
				viewModel.PropertyChanged += FolderSettings_PropertyChanged;
			Update();
		}

		private void FolderSettings_PropertyChanged(object? sender, PropertyChangedEventArgs e)
		{
			var viewModel = FolderSettings;
			if (viewModel is null)
				return;

			switch (e.PropertyName)
			{
				case nameof(LayoutPreferencesManager.LayoutMode):
				case nameof(LayoutPreferencesManager.IsAdaptiveLayoutEnabled):
					SetProperty(ref _LayoutType, GetLayoutType(), nameof(LayoutType));