Skip to content

Commit e61ffa2

Browse files
authored
Fix: Fixed issue where the adaptive layout toggle was always disabled (#12049)
1 parent eb9f89b commit e61ffa2

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

src/Files.App/Contexts/DisplayPage/DisplayPageContext.cs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,7 @@ internal class DisplayPageContext : ObservableObject, IDisplayPageContext
1414
private readonly IPageContext context = Ioc.Default.GetRequiredService<IPageContext>();
1515
private readonly IFoldersSettingsService settings = Ioc.Default.GetRequiredService<IFoldersSettingsService>();
1616

17-
private bool isLayoutAdaptiveEnabled = false;
18-
public bool IsLayoutAdaptiveEnabled
19-
{
20-
get => isLayoutAdaptiveEnabled;
21-
set => settings.SyncFolderPreferencesAcrossDirectories = value;
22-
}
17+
public bool IsLayoutAdaptiveEnabled => !settings.SyncFolderPreferencesAcrossDirectories;
2318

2419
private LayoutTypes layoutType = LayoutTypes.None;
2520
public LayoutTypes LayoutType
@@ -182,9 +177,8 @@ private void Settings_PropertyChanged(object? sender, PropertyChangedEventArgs e
182177
{
183178
if (e.PropertyName is nameof(IFoldersSettingsService.SyncFolderPreferencesAcrossDirectories))
184179
{
185-
bool isEnabled = settings.SyncFolderPreferencesAcrossDirectories;
186-
if (SetProperty(ref isLayoutAdaptiveEnabled, isEnabled, nameof(IsLayoutAdaptiveEnabled)))
187-
SetProperty(ref layoutType, GetLayoutType(), nameof(LayoutType));
180+
OnPropertyChanged(nameof(IsLayoutAdaptiveEnabled));
181+
SetProperty(ref layoutType, GetLayoutType(), nameof(LayoutType));
188182
}
189183
}
190184

@@ -216,7 +210,7 @@ private LayoutTypes GetLayoutType()
216210
if (viewModel is null)
217211
return LayoutTypes.None;
218212

219-
bool isAdaptive = isLayoutAdaptiveEnabled && viewModel.IsAdaptiveLayoutEnabled && !viewModel.IsLayoutModeFixed;
213+
bool isAdaptive = IsLayoutAdaptiveEnabled && viewModel.IsAdaptiveLayoutEnabled && !viewModel.IsLayoutModeFixed;
220214
if (isAdaptive)
221215
return LayoutTypes.Adaptive;
222216

src/Files.App/Contexts/DisplayPage/IDisplayPageContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace Files.App.Contexts
55
{
66
public interface IDisplayPageContext : INotifyPropertyChanging, INotifyPropertyChanged
77
{
8-
bool IsLayoutAdaptiveEnabled { get; set; }
8+
bool IsLayoutAdaptiveEnabled { get; }
99
LayoutTypes LayoutType { get; set; }
1010

1111
SortOption SortOption { get; set; }

0 commit comments

Comments
 (0)