From 767d88c57f7e041ca42fd8b71c89487f7c0964b1 Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Thu, 17 Jul 2025 15:33:02 -0400 Subject: [PATCH 1/6] Basic xaml --- src/Files.App/ViewModels/ShellViewModel.cs | 24 ++++++++++++-- .../Views/Shells/ModernShellPage.xaml | 32 ++++++++++++++++--- 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/src/Files.App/ViewModels/ShellViewModel.cs b/src/Files.App/ViewModels/ShellViewModel.cs index c96b09ddabd9..55acb96bc793 100644 --- a/src/Files.App/ViewModels/ShellViewModel.cs +++ b/src/Files.App/ViewModels/ShellViewModel.cs @@ -739,7 +739,26 @@ public void CancelExtendedPropertiesLoadingForItem(ListedItem item) itemLoadQueue.TryUpdate(item.ItemPath, true, false); } - private bool IsSearchResults { get; set; } + private bool _isSearchResults; + public bool IsSearchResults + { + get => _isSearchResults; + set + { + if (SetProperty(ref _isSearchResults, value)) + { + if (!value) + SearchHeaderTitle = string.Empty; + } + } + } + + private string? _searchHeaderTitle; + public string? SearchHeaderTitle + { + get => _searchHeaderTitle; + set => SetProperty(ref _searchHeaderTitle, value); + } public void UpdateEmptyTextType() { @@ -2682,7 +2701,7 @@ public async Task AddSearchResultsToCollectionAsync(ObservableCollection + @@ -58,7 +59,7 @@ + + + + + + + + From 1ee21358a03121df2acc5dd8e786c26e988d7b76 Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Thu, 17 Jul 2025 15:44:09 -0400 Subject: [PATCH 2/6] Text --- src/Files.App/Strings/en-US/Resources.resw | 3 +++ src/Files.App/ViewModels/ShellViewModel.cs | 5 ++++- src/Files.App/Views/Shells/ModernShellPage.xaml | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Files.App/Strings/en-US/Resources.resw b/src/Files.App/Strings/en-US/Resources.resw index d3bf746a0d3e..dc6dc947fbbf 100644 --- a/src/Files.App/Strings/en-US/Resources.resw +++ b/src/Files.App/Strings/en-US/Resources.resw @@ -1010,6 +1010,9 @@ Search results in {1} for {0} + + Search results for `{0}` + Details diff --git a/src/Files.App/ViewModels/ShellViewModel.cs b/src/Files.App/ViewModels/ShellViewModel.cs index 55acb96bc793..066de64dbab6 100644 --- a/src/Files.App/ViewModels/ShellViewModel.cs +++ b/src/Files.App/ViewModels/ShellViewModel.cs @@ -2710,7 +2710,10 @@ public async Task SearchAsync(FolderSearch search) HasNoWatcher = true; await ApplyFilesAndFoldersChangesAsync(); EmptyTextType = EmptyTextType.None; - SearchHeaderTitle = search.Query ?? string.Empty; + + SearchHeaderTitle = !string.IsNullOrEmpty(search.Query) + ? string.Format(Strings.SearchResultsFor.GetLocalizedResource(), search.Query) + : string.Empty; ItemLoadStatusChanged?.Invoke(this, new ItemLoadStatusChangedEventArgs() { Status = ItemLoadStatusChangedEventArgs.ItemLoadStatus.InProgress }); diff --git a/src/Files.App/Views/Shells/ModernShellPage.xaml b/src/Files.App/Views/Shells/ModernShellPage.xaml index a59558c81762..d1d3e244e126 100644 --- a/src/Files.App/Views/Shells/ModernShellPage.xaml +++ b/src/Files.App/Views/Shells/ModernShellPage.xaml @@ -104,7 +104,7 @@ From d31e6ba02481106a0a6c62a40f31c9f247744824 Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Thu, 17 Jul 2025 18:26:57 -0400 Subject: [PATCH 3/6] Search icon --- src/Files.App/Constants.cs | 1 + src/Files.App/Helpers/UI/UIHelpers.cs | 19 +++++++++++++++++++ src/Files.App/ViewModels/ShellViewModel.cs | 11 +++++++++++ .../Views/Shells/ModernShellPage.xaml | 8 ++++---- 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/Files.App/Constants.cs b/src/Files.App/Constants.cs index d5ecefa28323..cd124ecbfc98 100644 --- a/src/Files.App/Constants.cs +++ b/src/Files.App/Constants.cs @@ -56,6 +56,7 @@ public static class ImageRes public const int Libraries = 1023; public const int Folder = 3; public const int ShieldIcon = 78; + public const int SearchIcon = 177; } public static class Shell32 diff --git a/src/Files.App/Helpers/UI/UIHelpers.cs b/src/Files.App/Helpers/UI/UIHelpers.cs index cfc1bd5327d5..5307297fc968 100644 --- a/src/Files.App/Helpers/UI/UIHelpers.cs +++ b/src/Files.App/Helpers/UI/UIHelpers.cs @@ -106,6 +106,8 @@ public static void CloseAllDialogs() private static IconFileInfo ShieldIconResource = LoadShieldIconResource(); + private static IconFileInfo SearchIconResource = LoadSearchIconResource(); + public static IconFileInfo GetSidebarIconResourceInfo(int index) { var icons = UIHelpers.SidebarIconResources; @@ -128,6 +130,13 @@ public static IconFileInfo GetSidebarIconResourceInfo(int index) : null; } + public static async Task GetSearchIconResource() + { + return SearchIconResource is not null + ? await SearchIconResource.IconData.ToBitmapAsync() + : null; + } + private static IEnumerable LoadSidebarIconResources() { string imageres = Path.Combine(Constants.UserEnvironmentPaths.SystemRootPath, "System32", "imageres.dll"); @@ -153,5 +162,15 @@ private static IconFileInfo LoadShieldIconResource() return imageResList.FirstOrDefault(); } + + private static IconFileInfo LoadSearchIconResource() + { + string imageres = Path.Combine(Constants.UserEnvironmentPaths.SystemRootPath, "System32", "imageres.dll"); + var imageResList = Win32Helper.ExtractSelectedIconsFromDLL(imageres, new List() { + Constants.ImageRes.SearchIcon + }, 48); + + return imageResList.FirstOrDefault(); + } } } diff --git a/src/Files.App/ViewModels/ShellViewModel.cs b/src/Files.App/ViewModels/ShellViewModel.cs index 066de64dbab6..a79e89faa9df 100644 --- a/src/Files.App/ViewModels/ShellViewModel.cs +++ b/src/Files.App/ViewModels/ShellViewModel.cs @@ -121,6 +121,14 @@ public ImageSource? FolderThumbnailImageSource private set => SetProperty(ref _FolderThumbnailImageSource, value); } + private BitmapImage? _SearchIconBitmapImage; + public BitmapImage? SearchIconBitmapImage + { + get => _SearchIconBitmapImage; + private set => SetProperty(ref _SearchIconBitmapImage, value); + } + + public bool ShowFilterHeader => UserSettingsService.GeneralSettingsService.ShowFilterHeader && WorkingDirectory != "Home" && @@ -2715,6 +2723,9 @@ public async Task SearchAsync(FolderSearch search) ? string.Format(Strings.SearchResultsFor.GetLocalizedResource(), search.Query) : string.Empty; + if (SearchIconBitmapImage is null) + SearchIconBitmapImage ??= await UIHelpers.GetSearchIconResource(); + ItemLoadStatusChanged?.Invoke(this, new ItemLoadStatusChangedEventArgs() { Status = ItemLoadStatusChangedEventArgs.ItemLoadStatus.InProgress }); var results = new List(); diff --git a/src/Files.App/Views/Shells/ModernShellPage.xaml b/src/Files.App/Views/Shells/ModernShellPage.xaml index d1d3e244e126..cfd2f0c1564c 100644 --- a/src/Files.App/Views/Shells/ModernShellPage.xaml +++ b/src/Files.App/Views/Shells/ModernShellPage.xaml @@ -104,7 +104,7 @@ @@ -112,10 +112,10 @@ VerticalAlignment="Center" Orientation="Horizontal" Spacing="12"> - + Source="{x:Bind ShellViewModel.SearchIconBitmapImage, Mode=OneWay}" /> Date: Thu, 17 Jul 2025 23:59:01 -0400 Subject: [PATCH 4/6] Update string --- src/Files.App/Strings/en-US/Resources.resw | 2 +- src/Files.App/ViewModels/ShellViewModel.cs | 2 +- src/Files.App/Views/Shells/ModernShellPage.xaml | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Files.App/Strings/en-US/Resources.resw b/src/Files.App/Strings/en-US/Resources.resw index dc6dc947fbbf..a3a6c5ec6351 100644 --- a/src/Files.App/Strings/en-US/Resources.resw +++ b/src/Files.App/Strings/en-US/Resources.resw @@ -1011,7 +1011,7 @@ Search results in {1} for {0} - Search results for `{0}` + Search results for Details diff --git a/src/Files.App/ViewModels/ShellViewModel.cs b/src/Files.App/ViewModels/ShellViewModel.cs index a79e89faa9df..543566b17aca 100644 --- a/src/Files.App/ViewModels/ShellViewModel.cs +++ b/src/Files.App/ViewModels/ShellViewModel.cs @@ -2720,7 +2720,7 @@ public async Task SearchAsync(FolderSearch search) EmptyTextType = EmptyTextType.None; SearchHeaderTitle = !string.IsNullOrEmpty(search.Query) - ? string.Format(Strings.SearchResultsFor.GetLocalizedResource(), search.Query) + ? $"`{search.Query}`" : string.Empty; if (SearchIconBitmapImage is null) diff --git a/src/Files.App/Views/Shells/ModernShellPage.xaml b/src/Files.App/Views/Shells/ModernShellPage.xaml index cfd2f0c1564c..b7e29e8685d5 100644 --- a/src/Files.App/Views/Shells/ModernShellPage.xaml +++ b/src/Files.App/Views/Shells/ModernShellPage.xaml @@ -116,10 +116,10 @@ Height="24" VerticalAlignment="Center" Source="{x:Bind ShellViewModel.SearchIconBitmapImage, Mode=OneWay}" /> - + + + + From 8b8861d24785b7a40a2fbb5fb70ca9bba164c53e Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Tue, 22 Jul 2025 22:51:43 -0400 Subject: [PATCH 5/6] Revert "Update string" This reverts commit 80f982848570d656a14893e7495ef76637c83152. --- src/Files.App/Strings/en-US/Resources.resw | 2 +- src/Files.App/ViewModels/ShellViewModel.cs | 2 +- src/Files.App/Views/Shells/ModernShellPage.xaml | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Files.App/Strings/en-US/Resources.resw b/src/Files.App/Strings/en-US/Resources.resw index a3a6c5ec6351..dc6dc947fbbf 100644 --- a/src/Files.App/Strings/en-US/Resources.resw +++ b/src/Files.App/Strings/en-US/Resources.resw @@ -1011,7 +1011,7 @@ Search results in {1} for {0} - Search results for + Search results for `{0}` Details diff --git a/src/Files.App/ViewModels/ShellViewModel.cs b/src/Files.App/ViewModels/ShellViewModel.cs index 543566b17aca..a79e89faa9df 100644 --- a/src/Files.App/ViewModels/ShellViewModel.cs +++ b/src/Files.App/ViewModels/ShellViewModel.cs @@ -2720,7 +2720,7 @@ public async Task SearchAsync(FolderSearch search) EmptyTextType = EmptyTextType.None; SearchHeaderTitle = !string.IsNullOrEmpty(search.Query) - ? $"`{search.Query}`" + ? string.Format(Strings.SearchResultsFor.GetLocalizedResource(), search.Query) : string.Empty; if (SearchIconBitmapImage is null) diff --git a/src/Files.App/Views/Shells/ModernShellPage.xaml b/src/Files.App/Views/Shells/ModernShellPage.xaml index b7e29e8685d5..cfd2f0c1564c 100644 --- a/src/Files.App/Views/Shells/ModernShellPage.xaml +++ b/src/Files.App/Views/Shells/ModernShellPage.xaml @@ -116,10 +116,10 @@ Height="24" VerticalAlignment="Center" Source="{x:Bind ShellViewModel.SearchIconBitmapImage, Mode=OneWay}" /> - - - - + From 06277e19ce6154c2c100405594b52de6eacb6ffe Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Mon, 4 Aug 2025 10:36:55 -0400 Subject: [PATCH 6/6] Update ShellViewModel.cs --- src/Files.App/ViewModels/ShellViewModel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Files.App/ViewModels/ShellViewModel.cs b/src/Files.App/ViewModels/ShellViewModel.cs index a79e89faa9df..bab020065ce7 100644 --- a/src/Files.App/ViewModels/ShellViewModel.cs +++ b/src/Files.App/ViewModels/ShellViewModel.cs @@ -2709,7 +2709,7 @@ public async Task AddSearchResultsToCollectionAsync(ObservableCollection