Skip to content

Commit d221dbd

Browse files
committed
Improve
1 parent 810eb01 commit d221dbd

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

src/Files.App/Data/Items/ListedItem.cs

+7
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,13 @@ public string DimensionsDisplay
365365
}
366366
}
367367

368+
// This is used to avoid passing a null value to AutomationProperties.Name, which causes a crash
369+
public string ContextualPropertyString => FileExtension switch
370+
{
371+
_ when FileExtensionHelpers.IsImageFile(FileExtension) => string.IsNullOrEmpty(DimensionsDisplay) ? string.Empty : string.Join(": ", Strings.PropertyDimensions.GetLocalizedResource(), DimensionsDisplay),
372+
_ => string.IsNullOrEmpty(ItemDateModified) ? string.Empty : string.Join(": ", Strings.Modified.GetLocalizedResource(), ItemDateModified)
373+
};
374+
368375
/// <summary>
369376
/// Initializes a new instance of the <see cref="ListedItem" /> class.
370377
/// </summary>

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

+6-4
Original file line numberDiff line numberDiff line change
@@ -597,18 +597,20 @@
597597
</TextBox>
598598

599599
<StackPanel
600-
Grid.Row="3"
601-
Grid.RowSpan="2"
600+
Grid.Row="2"
601+
Grid.RowSpan="3"
602602
VerticalAlignment="Bottom"
603603
Orientation="Vertical"
604604
Spacing="4">
605605

606606
<!-- Contextual Property -->
607-
<!--<TextBlock
607+
<TextBlock
608608
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
609609
Style="{ThemeResource CaptionTextBlockStyle}"
610+
Text="{x:Bind ContextualPropertyString, Mode=OneWay}"
610611
TextTrimming="CharacterEllipsis"
611-
TextWrapping="NoWrap" />-->
612+
TextWrapping="NoWrap"
613+
Visibility="{Binding ElementName=PageRoot, Path=CardsViewShowContextualProperty, Mode=OneWay}" />
612614

613615
<!-- Item Size -->
614616
<TextBlock

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

+6-9
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ public sealed partial class GridLayoutPage : BaseGroupableLayoutPage
128128
public int CardsViewItemNameMaxLines =>
129129
LayoutSettingsService.CardsViewSize == CardsViewSizeKind.ExtraLarge ? 1 : 2;
130130

131+
/// <summary>
132+
/// Gets the visibility for the contextual property string in the Cards View layout.
133+
/// </summary>
134+
public bool CardsViewShowContextualProperty=>
135+
LayoutSettingsService.CardsViewSize != CardsViewSizeKind.Small;
136+
131137
/// <summary>
132138
/// Gets the icon size for item names in the Cards View layout.
133139
/// </summary>
@@ -235,15 +241,6 @@ private void LayoutSettingsService_PropertyChanged(object? sender, PropertyChang
235241
}
236242
if (e.PropertyName == nameof(ILayoutSettingsService.CardsViewSize))
237243
{
238-
NotifyPropertyChanged(nameof(CardsViewIconBoxHeight));
239-
NotifyPropertyChanged(nameof(CardsViewIconBoxWidth));
240-
NotifyPropertyChanged(nameof(CardsViewIconSize));
241-
NotifyPropertyChanged(nameof(CardsViewDetailsBoxHeight));
242-
NotifyPropertyChanged(nameof(CardsViewDetailsBoxWidth));
243-
NotifyPropertyChanged(nameof(CardsViewItemNameMaxLines));
244-
NotifyPropertyChanged(nameof(CardsViewItemNameMaxLines));
245-
246-
247244
// Update the container style to match the item size
248245
SetItemContainerStyle();
249246
FolderSettings_IconSizeChanged();

0 commit comments

Comments
 (0)