Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Quality: Fix column layout sizing #14822

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Files.App/Views/Layouts/ColumnLayoutPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="MinHeight" Value="1" />
<Setter Property="Margin" Value="-2" />
<Setter Property="Padding" Value="4,0" />
</Style>

<Style
Expand All @@ -140,6 +141,7 @@
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="MinHeight" Value="1" />
<Setter Property="Margin" Value="0" />
<Setter Property="Padding" Value="4,0" />
</Style>

</local:BaseGroupableLayoutPage.Resources>
Expand Down
11 changes: 3 additions & 8 deletions src/Files.App/Views/Layouts/ColumnLayoutPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@ public sealed partial class ColumnLayoutPage : BaseGroupableLayoutPage
public int RowHeight
{
get => LayoutSizeKindHelper.GetColumnsViewRowHeight(UserSettingsService.LayoutSettingsService.ColumnsViewSize);
set
{
if (value != LayoutSizeKindHelper.GetColumnsViewRowHeight(UserSettingsService.LayoutSettingsService.ColumnsViewSize))
{
NotifyPropertyChanged(nameof(RowHeight));
}
}
}

// Constructor
Expand Down Expand Up @@ -178,7 +171,9 @@ private void LayoutSettingsService_PropertyChanged(object? sender, PropertyChang

if (e.PropertyName == nameof(ILayoutSettingsService.ColumnsViewSize))
{
RowHeight = LayoutSizeKindHelper.GetColumnsViewRowHeight(UserSettingsService.LayoutSettingsService.ColumnsViewSize);
NotifyPropertyChanged(nameof(RowHeight));

// Update the container style to match the item size
SetItemContainerStyle();
}
}
Expand Down
7 changes: 1 addition & 6 deletions src/Files.App/Views/Layouts/DetailsLayoutPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ public double MaxWidthForRenameTextbox
public int RowHeight
{
get => LayoutSizeKindHelper.GetDetailsViewRowHeight((DetailsViewSizeKind)UserSettingsService.LayoutSettingsService.DetailsViewSize);
set
{
if (value != LayoutSizeKindHelper.GetDetailsViewRowHeight((DetailsViewSizeKind)UserSettingsService.LayoutSettingsService.DetailsViewSize))
NotifyPropertyChanged(nameof(RowHeight));
}
}


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

RowHeight = LayoutSizeKindHelper.GetDetailsViewRowHeight(UserSettingsService.LayoutSettingsService.DetailsViewSize);
NotifyPropertyChanged(nameof(RowHeight));

// Update the container style to match the item size
SetItemContainerStyle();
Expand Down
29 changes: 11 additions & 18 deletions src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ public sealed partial class GridLayoutPage : BaseGroupableLayoutPage
public int RowHeightListView
{
get => LayoutSizeKindHelper.GetListViewRowHeight(UserSettingsService.LayoutSettingsService.ListViewSize);
set
{
if (value != LayoutSizeKindHelper.GetListViewRowHeight(UserSettingsService.LayoutSettingsService.ListViewSize))
NotifyPropertyChanged(nameof(RowHeightListView));
}
}

/// <summary>
Expand All @@ -51,11 +46,6 @@ public int RowHeightListView
public int ItemWidthTilesView
{
get => LayoutSizeKindHelper.GetTilesViewItemWidth(UserSettingsService.LayoutSettingsService.TilesViewSize);
set
{
if (value != LayoutSizeKindHelper.GetTilesViewItemWidth(UserSettingsService.LayoutSettingsService.TilesViewSize))
NotifyPropertyChanged(nameof(ItemWidthTilesView));
}
}

/// <summary>
Expand All @@ -64,11 +54,6 @@ public int ItemWidthTilesView
public int ItemWidthGridView
{
get => LayoutSizeKindHelper.GetGridViewItemWidth(UserSettingsService.LayoutSettingsService.GridViewSize);
set
{
if (value != LayoutSizeKindHelper.GetGridViewItemWidth(UserSettingsService.LayoutSettingsService.GridViewSize))
NotifyPropertyChanged(nameof(ItemWidthGridView));
}
}

public bool IsPointerOver
Expand Down Expand Up @@ -166,20 +151,28 @@ private void LayoutSettingsService_PropertyChanged(object? sender, PropertyChang

if (e.PropertyName == nameof(ILayoutSettingsService.ListViewSize))
{
RowHeightListView = LayoutSizeKindHelper.GetListViewRowHeight(UserSettingsService.LayoutSettingsService.ListViewSize);
NotifyPropertyChanged(nameof(RowHeightListView));

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

FolderSettings_IconHeightChanged();
}
if (e.PropertyName == nameof(ILayoutSettingsService.TilesViewSize))
{
ItemWidthTilesView = LayoutSizeKindHelper.GetTilesViewItemWidth(UserSettingsService.LayoutSettingsService.TilesViewSize);
NotifyPropertyChanged(nameof(ItemWidthTilesView));

// Update the container style to match the item size
SetItemContainerStyle();
FolderSettings_IconHeightChanged();
}
if (e.PropertyName == nameof(ILayoutSettingsService.GridViewSize))
{
ItemWidthGridView = LayoutSizeKindHelper.GetGridViewItemWidth(UserSettingsService.LayoutSettingsService.GridViewSize);
NotifyPropertyChanged(nameof(ItemWidthGridView));

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

FolderSettings_IconHeightChanged();
}
}
Expand Down
Loading