Skip to content

Commit

Permalink
Columns
Browse files Browse the repository at this point in the history
  • Loading branch information
yaira2 committed Feb 23, 2024
1 parent e029afe commit 2999a6c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 58 deletions.
51 changes: 2 additions & 49 deletions src/Files.App/Views/Layouts/ColumnLayoutPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,62 +131,15 @@
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="MinHeight" Value="1" />
<Setter Property="Margin" Value="-2" />
<Setter Property="Height" Value="28" />
<Setter Property="Padding" Value="4,0" />
</Style>

<Style
x:Name="SmallItemContainerStyle"
x:Name="RegularItemContainerStyle"
BasedOn="{StaticResource DefaultListViewItemStyle}"
TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="MinHeight" Value="1" />
<Setter Property="Margin" Value="0" />
<Setter Property="Height" Value="36" />
<Setter Property="Padding" Value="4,0" />
</Style>

<Style
x:Name="MediumItemContainerStyle"
BasedOn="{StaticResource DefaultListViewItemStyle}"
TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="MinHeight" Value="1" />
<Setter Property="Margin" Value="0" />
<Setter Property="Height" Value="40" />
<Setter Property="Padding" Value="4,0" />
</Style>

<Style
x:Name="LargeItemContainerStyle"
BasedOn="{StaticResource DefaultListViewItemStyle}"
TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="MinHeight" Value="1" />
<Setter Property="Margin" Value="0" />
<Setter Property="Height" Value="44" />
<Setter Property="Padding" Value="4,0" />
</Style>

<Style
x:Name="ExtraLargeItemContainerStyle"
BasedOn="{StaticResource DefaultListViewItemStyle}"
TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="MinHeight" Value="1" />
<Setter Property="Margin" Value="0" />
<Setter Property="Height" Value="48" />
<Setter Property="Padding" Value="4,0" />
</Style>

<Style
x:Name="MaximumItemContainerStyle"
BasedOn="{StaticResource DefaultListViewItemStyle}"
TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="MinHeight" Value="1" />
<Setter Property="Margin" Value="0" />
<Setter Property="Height" Value="40" />
</Style>

</local:BaseGroupableLayoutPage.Resources>
Expand Down Expand Up @@ -253,7 +206,7 @@
<DataTemplate x:DataType="filesystem:ListedItem">
<Grid
x:Name="FilesRootGrid"
Height="30"
Height="{Binding RowHeight, ElementName=PageRoot, Mode=OneWay}"
Padding="12,0,12,0"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Expand Down
25 changes: 16 additions & 9 deletions src/Files.App/Views/Layouts/ColumnLayoutPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,20 +235,27 @@ public override void ResetItemOpacity()
protected override bool CanGetItemFromElement(object element)
=> element is ListViewItem;

/// <summary>
/// Sets the item size and spacing
/// </summary>
private void SetItemContainerStyle()
{
var itemSizeColumnsView = UserSettingsService.LayoutSettingsService.ItemSizeColumnsView;
if (UserSettingsService.LayoutSettingsService.ItemSizeColumnsView == ColumnsViewSizeKind.Compact)
{
// Toggle style to force item size to update
FileList.ItemContainerStyle = RegularItemContainerStyle;

if (itemSizeColumnsView == ColumnsViewSizeKind.Compact)
// Set correct style
FileList.ItemContainerStyle = CompactItemContainerStyle;
else if (itemSizeColumnsView == ColumnsViewSizeKind.Small)
FileList.ItemContainerStyle = SmallItemContainerStyle;
else if (itemSizeColumnsView == ColumnsViewSizeKind.Medium)
FileList.ItemContainerStyle = MediumItemContainerStyle;
else if (itemSizeColumnsView == ColumnsViewSizeKind.Large)
FileList.ItemContainerStyle = LargeItemContainerStyle;
}
else
FileList.ItemContainerStyle = ExtraLargeItemContainerStyle;
{
// Toggle style to force item size to update
FileList.ItemContainerStyle = CompactItemContainerStyle;

// Set correct style
FileList.ItemContainerStyle = RegularItemContainerStyle;
}
}

public override void Dispose()
Expand Down

0 comments on commit 2999a6c

Please sign in to comment.