Skip to content

Commit dafe1cb

Browse files
authored
Fix: Fixed an issue where the items count was sometimes incorrect in the Details Pane (#18171)
1 parent 94e6559 commit dafe1cb

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/Files.App/ViewModels/UserControls/InfoPaneViewModel.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ public PreviewPaneStates PreviewPaneState
101101
}
102102
}
103103

104+
private string? _DirectoryItemCount;
105+
public string? DirectoryItemCount
106+
{
107+
get => _DirectoryItemCount;
108+
set => SetProperty(ref _DirectoryItemCount, value);
109+
}
110+
104111
/// <summary>
105112
/// Value indicating if the download cloud files option should be displayed
106113
/// </summary>

src/Files.App/ViewModels/UserControls/Previews/FolderPreviewViewModel.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ namespace Files.App.ViewModels.Previews
99
{
1010
public sealed class FolderPreviewViewModel
1111
{
12+
private readonly InfoPaneViewModel infoPaneViewModel = Ioc.Default.GetRequiredService<InfoPaneViewModel>();
1213
public ListedItem Item { get; }
1314

1415
public BitmapImage Thumbnail { get; set; } = new();
@@ -46,7 +47,7 @@ private async Task LoadPreviewAndDetailsAsync()
4647

4748
Item.FileDetails =
4849
[
49-
GetFileProperty("PropertyItemCount", items.Count),
50+
GetFileProperty("PropertyItemCount", infoPaneViewModel?.DirectoryItemCount),
5051
GetFileProperty("PropertyDateModified", info.DateModified),
5152
GetFileProperty("PropertyDateCreated", info.DateCreated),
5253
GetFileProperty("PropertyParsingPath", Folder.Path),

src/Files.App/Views/Shells/BaseShellPage.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ protected async void FilesystemViewModel_DirectoryInfoUpdated(object sender, Eve
266266
}
267267

268268
contentPage.StatusBarViewModel.DirectoryItemCount = $"{ShellViewModel.FilesAndFolders.Count} {directoryItemCountLocalization}";
269+
contentPage.InfoPaneViewModel.DirectoryItemCount = $"{ShellViewModel.FilesAndFolders.Count} {directoryItemCountLocalization}";
269270
contentPage.UpdateSelectionSize();
270271
}
271272

0 commit comments

Comments
 (0)