Skip to content

Commit cd5a41e

Browse files
committed
Hide footer when list is empty
1 parent aaf7cc7 commit cd5a41e

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/Files.App/Converters/Converters.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,5 +251,18 @@ protected override Visibility Convert(object? value, object? parameter, string?
251251
return new NotSupportedException();
252252
}
253253
}
254+
255+
internal sealed partial class PopulatedListToVisibilityConverter : ValueConverter<object?, Visibility>
256+
{
257+
protected override Visibility Convert(object? value, object? parameter, string? language)
258+
{
259+
return (value is int count && count > 0) ? Visibility.Visible : Visibility.Collapsed;
260+
}
261+
262+
protected override object? ConvertBack(Visibility value, object? parameter, string? language)
263+
{
264+
return new NotSupportedException();
265+
}
266+
}
254267
}
255268

src/Files.App/UserControls/Pane/ShelfPane.xaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<UserControl.Resources>
1414
<ResourceDictionary>
1515
<converters:EmptyListToVisibilityConverter x:Key="EmptyListToVisibilityConverter" />
16+
<converters:PopulatedListToVisibilityConverter x:Key="PopulatedListToVisibilityConverter" />
1617
<converters:ImageModelToImageConverter x:Key="ImageModelToImageConverter" />
1718

1819
<ResourceDictionary.ThemeDictionaries>
@@ -152,7 +153,8 @@
152153
<StackPanel
153154
Grid.Row="2"
154155
Padding="12,12,12,4"
155-
Spacing="4">
156+
Spacing="4"
157+
Visibility="{x:Bind ItemsSource.Count, Converter={StaticResource PopulatedListToVisibilityConverter}, Mode=OneWay}">
156158

157159
<!-- (Divider) -->
158160
<Border Height="1" Background="{ThemeResource DividerStrokeColorDefaultBrush}" />

0 commit comments

Comments
 (0)