Skip to content

Commit e9df282

Browse files
authored
Feature: Display item size in tooltip (#11069)
1 parent 0cecd0e commit e9df282

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

src/Files.App/Filesystem/ListedItem.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using System.Collections.Generic;
1616
using System.Collections.ObjectModel;
1717
using System.IO;
18+
using System.Text;
1819
using System.Threading;
1920
using System.Threading.Tasks;
2021
using Windows.Storage;
@@ -46,12 +47,16 @@ public string ItemTooltipText
4647
{
4748
get
4849
{
49-
return $"{"ToolTipDescriptionName".GetLocalizedResource()} {Name}{Environment.NewLine}" +
50-
$"{"ToolTipDescriptionType".GetLocalizedResource()} {itemType}{Environment.NewLine}" +
51-
$"{"ToolTipDescriptionDate".GetLocalizedResource()} {ItemDateModified}" +
52-
(SyncStatusUI.LoadSyncStatus
53-
? $"{Environment.NewLine}{"syncStatusColumn/Header".GetLocalizedResource()}: {syncStatusUI.SyncStatusString}"
54-
: string.Empty);
50+
var tooltipBuilder = new StringBuilder();
51+
tooltipBuilder.AppendLine($"{"ToolTipDescriptionName".GetLocalizedResource()} {Name}");
52+
tooltipBuilder.AppendLine($"{"ToolTipDescriptionType".GetLocalizedResource()} {itemType}");
53+
tooltipBuilder.Append($"{"ToolTipDescriptionDate".GetLocalizedResource()} {ItemDateModified}");
54+
if(!string.IsNullOrWhiteSpace(FileSize))
55+
tooltipBuilder.Append($"{Environment.NewLine}{"ToolTipDescriptionSize".GetLocalizedResource()} {FileSize}");
56+
if(SyncStatusUI.LoadSyncStatus)
57+
tooltipBuilder.Append($"{Environment.NewLine}{"syncStatusColumn/Header".GetLocalizedResource()}: {syncStatusUI.SyncStatusString}");
58+
59+
return tooltipBuilder.ToString();
5560
}
5661
}
5762

src/Files.App/Strings/en-US/Resources.resw

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2886,4 +2886,7 @@
28862886
<data name="DoubleClickBlankSpaceToGoUp" xml:space="preserve">
28872887
<value>Double click on a blank space to go up one directory</value>
28882888
</data>
2889+
<data name="ToolTipDescriptionSize" xml:space="preserve">
2890+
<value>Size:</value>
2891+
</data>
28892892
</root>

src/Files.App/Views/LayoutModes/ColumnViewBase.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
CornerRadius="{StaticResource ControlCornerRadius}"
188188
IsRightTapEnabled="True"
189189
Loaded="Grid_Loaded"
190-
ToolTipService.ToolTip="{x:Bind Name, Mode=OneWay}">
190+
ToolTipService.ToolTip="{x:Bind ItemTooltipText, Mode=OneWay}">
191191
<Grid.ColumnDefinitions>
192192
<ColumnDefinition Width="24" />
193193
<ColumnDefinition Width="*" />

0 commit comments

Comments
 (0)