Skip to content

Commit

Permalink
Feature: Removed margin when using the Compact Spacing option (files-…
Browse files Browse the repository at this point in the history
  • Loading branch information
yaira2 authored Aug 7, 2023
1 parent 6194696 commit b03c2fd
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 15 deletions.
3 changes: 3 additions & 0 deletions src/Files.App/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
<!-- Default list view item height -->
<x:Double x:Key="ListItemHeight">36</x:Double>

<!-- Default list view item margin -->
<x:Double x:Key="ListItemMargin">0</x:Double>

<!-- Default nav menu item height -->
<x:Double x:Key="NavigationViewItemOnLeftMinHeight">32</x:Double>

Expand Down
4 changes: 3 additions & 1 deletion src/Files.App/Services/ResourcesService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ public void SetAppThemeFontFamily(string contentControlThemeFontFamily)
/// <inheritdoc/>
public void SetCompactSpacing(bool useCompactSpacing)
{
var listItemHeight = useCompactSpacing ? 24 : 36;
var listItemHeight = useCompactSpacing ? 28 : 36;
var listItemMargin = useCompactSpacing ? "-2" : "0";
var navigationViewItemOnLeftMinHeight = useCompactSpacing ? 20 : 32;

Application.Current.Resources["ListItemHeight"] = listItemHeight;
Application.Current.Resources["ListItemMargin"] = listItemMargin;
Application.Current.Resources["NavigationViewItemOnLeftMinHeight"] = navigationViewItemOnLeftMinHeight;
}

Expand Down
1 change: 1 addition & 0 deletions src/Files.App/UserControls/Widgets/RecentFilesWidget.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<Style BasedOn="{StaticResource DefaultListViewItemStyle}" TargetType="ListViewItem">
<Setter Property="MinHeight" Value="1" />
<Setter Property="Height" Value="{ThemeResource ListItemHeight}" />
<Setter Property="Margin" Value="{ThemeResource ListItemMargin}" />
</Style>
</ListView.ItemContainerStyle>

Expand Down
1 change: 1 addition & 0 deletions src/Files.App/Views/LayoutModes/ColumnViewBase.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@
<Style BasedOn="{StaticResource DefaultListViewItemStyle}" TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="MinHeight" Value="1" />
<Setter Property="Margin" Value="{ThemeResource ListItemMargin}" />
<Setter Property="Height" Value="{ThemeResource ListItemHeight}" />
<Setter Property="Padding" Value="4,0" />
</Style>
Expand Down
1 change: 1 addition & 0 deletions src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -1418,6 +1418,7 @@
<Style BasedOn="{StaticResource DefaultListViewItemStyle}" TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="MinHeight" Value="1" />
<Setter Property="Margin" Value="{ThemeResource ListItemMargin}" />
<Setter Property="Height" Value="{ThemeResource ListItemHeight}" />
</Style>
</ListView.ItemContainerStyle>
Expand Down
7 changes: 0 additions & 7 deletions src/Files.App/Views/Properties/SecurityAdvancedPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,6 @@
<behaviors:StickyHeaderBehavior />
</i:Interaction.Behaviors>

<ListView.ItemContainerStyle>
<Style BasedOn="{StaticResource DefaultListViewItemStyle}" TargetType="ListViewItem">
<Setter Property="MinHeight" Value="1" />
<Setter Property="Height" Value="{ThemeResource ListItemHeight}" />
</Style>
</ListView.ItemContainerStyle>

<ListView.Header>
<Grid
x:Name="HeaderGrid"
Expand Down
7 changes: 0 additions & 7 deletions src/Files.App/Views/Properties/SecurityPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,6 @@
SelectedItem="{x:Bind SecurityViewModel.SelectedAccessControlEntry, Mode=TwoWay}"
SelectionMode="Single">

<ListView.ItemContainerStyle>
<Style BasedOn="{StaticResource DefaultListViewItemStyle}" TargetType="ListViewItem">
<Setter Property="MinHeight" Value="1" />
<Setter Property="Height" Value="{ThemeResource ListItemHeight}" />
</Style>
</ListView.ItemContainerStyle>

<ListView.ItemTemplate>
<DataTemplate x:DataType="security:AccessControlEntry">
<Grid ColumnSpacing="4">
Expand Down

0 comments on commit b03c2fd

Please sign in to comment.