Skip to content

Commit 6ab55cc

Browse files
authored
Code Quality: Fix column layout sizing (#14822)
1 parent 8600d3d commit 6ab55cc

File tree

4 files changed

+17
-32
lines changed

4 files changed

+17
-32
lines changed

src/Files.App/Views/Layouts/ColumnLayoutPage.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
132132
<Setter Property="MinHeight" Value="1" />
133133
<Setter Property="Margin" Value="-2" />
134+
<Setter Property="Padding" Value="4,0" />
134135
</Style>
135136

136137
<Style
@@ -140,6 +141,7 @@
140141
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
141142
<Setter Property="MinHeight" Value="1" />
142143
<Setter Property="Margin" Value="0" />
144+
<Setter Property="Padding" Value="4,0" />
143145
</Style>
144146

145147
</local:BaseGroupableLayoutPage.Resources>

src/Files.App/Views/Layouts/ColumnLayoutPage.xaml.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,6 @@ public sealed partial class ColumnLayoutPage : BaseGroupableLayoutPage
4848
public int RowHeight
4949
{
5050
get => LayoutSizeKindHelper.GetColumnsViewRowHeight(UserSettingsService.LayoutSettingsService.ColumnsViewSize);
51-
set
52-
{
53-
if (value != LayoutSizeKindHelper.GetColumnsViewRowHeight(UserSettingsService.LayoutSettingsService.ColumnsViewSize))
54-
{
55-
NotifyPropertyChanged(nameof(RowHeight));
56-
}
57-
}
5851
}
5952

6053
// Constructor
@@ -178,7 +171,9 @@ private void LayoutSettingsService_PropertyChanged(object? sender, PropertyChang
178171

179172
if (e.PropertyName == nameof(ILayoutSettingsService.ColumnsViewSize))
180173
{
181-
RowHeight = LayoutSizeKindHelper.GetColumnsViewRowHeight(UserSettingsService.LayoutSettingsService.ColumnsViewSize);
174+
NotifyPropertyChanged(nameof(RowHeight));
175+
176+
// Update the container style to match the item size
182177
SetItemContainerStyle();
183178
}
184179
}

src/Files.App/Views/Layouts/DetailsLayoutPage.xaml.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,6 @@ public double MaxWidthForRenameTextbox
6161
public int RowHeight
6262
{
6363
get => LayoutSizeKindHelper.GetDetailsViewRowHeight((DetailsViewSizeKind)UserSettingsService.LayoutSettingsService.DetailsViewSize);
64-
set
65-
{
66-
if (value != LayoutSizeKindHelper.GetDetailsViewRowHeight((DetailsViewSizeKind)UserSettingsService.LayoutSettingsService.DetailsViewSize))
67-
NotifyPropertyChanged(nameof(RowHeight));
68-
}
6964
}
7065

7166

@@ -200,7 +195,7 @@ private void LayoutSettingsService_PropertyChanged(object? sender, PropertyChang
200195
// Get current scroll position
201196
var previousOffset = ContentScroller?.VerticalOffset;
202197

203-
RowHeight = LayoutSizeKindHelper.GetDetailsViewRowHeight(UserSettingsService.LayoutSettingsService.DetailsViewSize);
198+
NotifyPropertyChanged(nameof(RowHeight));
204199

205200
// Update the container style to match the item size
206201
SetItemContainerStyle();

src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ public sealed partial class GridLayoutPage : BaseGroupableLayoutPage
3838
public int RowHeightListView
3939
{
4040
get => LayoutSizeKindHelper.GetListViewRowHeight(UserSettingsService.LayoutSettingsService.ListViewSize);
41-
set
42-
{
43-
if (value != LayoutSizeKindHelper.GetListViewRowHeight(UserSettingsService.LayoutSettingsService.ListViewSize))
44-
NotifyPropertyChanged(nameof(RowHeightListView));
45-
}
4641
}
4742

4843
/// <summary>
@@ -51,11 +46,6 @@ public int RowHeightListView
5146
public int ItemWidthTilesView
5247
{
5348
get => LayoutSizeKindHelper.GetTilesViewItemWidth(UserSettingsService.LayoutSettingsService.TilesViewSize);
54-
set
55-
{
56-
if (value != LayoutSizeKindHelper.GetTilesViewItemWidth(UserSettingsService.LayoutSettingsService.TilesViewSize))
57-
NotifyPropertyChanged(nameof(ItemWidthTilesView));
58-
}
5949
}
6050

6151
/// <summary>
@@ -64,11 +54,6 @@ public int ItemWidthTilesView
6454
public int ItemWidthGridView
6555
{
6656
get => LayoutSizeKindHelper.GetGridViewItemWidth(UserSettingsService.LayoutSettingsService.GridViewSize);
67-
set
68-
{
69-
if (value != LayoutSizeKindHelper.GetGridViewItemWidth(UserSettingsService.LayoutSettingsService.GridViewSize))
70-
NotifyPropertyChanged(nameof(ItemWidthGridView));
71-
}
7257
}
7358

7459
public bool IsPointerOver
@@ -166,20 +151,28 @@ private void LayoutSettingsService_PropertyChanged(object? sender, PropertyChang
166151

167152
if (e.PropertyName == nameof(ILayoutSettingsService.ListViewSize))
168153
{
169-
RowHeightListView = LayoutSizeKindHelper.GetListViewRowHeight(UserSettingsService.LayoutSettingsService.ListViewSize);
154+
NotifyPropertyChanged(nameof(RowHeightListView));
155+
156+
// Update the container style to match the item size
170157
SetItemContainerStyle();
158+
171159
FolderSettings_IconHeightChanged();
172160
}
173161
if (e.PropertyName == nameof(ILayoutSettingsService.TilesViewSize))
174162
{
175-
ItemWidthTilesView = LayoutSizeKindHelper.GetTilesViewItemWidth(UserSettingsService.LayoutSettingsService.TilesViewSize);
163+
NotifyPropertyChanged(nameof(ItemWidthTilesView));
164+
165+
// Update the container style to match the item size
176166
SetItemContainerStyle();
177167
FolderSettings_IconHeightChanged();
178168
}
179169
if (e.PropertyName == nameof(ILayoutSettingsService.GridViewSize))
180170
{
181-
ItemWidthGridView = LayoutSizeKindHelper.GetGridViewItemWidth(UserSettingsService.LayoutSettingsService.GridViewSize);
171+
NotifyPropertyChanged(nameof(ItemWidthGridView));
172+
173+
// Update the container style to match the item size
182174
SetItemContainerStyle();
175+
183176
FolderSettings_IconHeightChanged();
184177
}
185178
}

0 commit comments

Comments
 (0)