From 80a933db8eee3b388dec39b3f1fcb1d81f1ab8fc Mon Sep 17 00:00:00 2001 From: Marterich <47688561+Marterich@users.noreply.github.com> Date: Wed, 16 Oct 2024 08:03:14 +0200 Subject: [PATCH] Fix Whitespace when using Search --- functions/public/Invoke-WPFUIApps.ps1 | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/functions/public/Invoke-WPFUIApps.ps1 b/functions/public/Invoke-WPFUIApps.ps1 index 7990fcbf5..c23b374be 100644 --- a/functions/public/Invoke-WPFUIApps.ps1 +++ b/functions/public/Invoke-WPFUIApps.ps1 @@ -65,22 +65,21 @@ function Search-AppsByNameOrDescription { } else { $ItemsControl.Items | ForEach-Object { + # Hide all CategoryWrapPanel and ToggleButton + $_.Visibility = [Windows.Visibility]::Collapsed if ($_.Tag -like "CategoryWrapPanel_*") { - $_.Visibility = [Windows.Visibility]::Visible # Search for Apps that match the search string $_.Children | Foreach-Object { if ($sync.configs.applicationsHashtable.$($_.Tag).Content -like "*$SearchString*") { + # Show the App and the parent CategoryWrapPanel $_.Visibility = [Windows.Visibility]::Visible + $_.parent.Visibility = [Windows.Visibility]::Visible } else { $_.Visibility = [Windows.Visibility]::Collapsed } } } - else { - # Hide all Category Labels - $_.Visibility = [Windows.Visibility]::Collapsed - } } } } @@ -254,7 +253,6 @@ function Invoke-WPFUIApps { $scrollViewer.HorizontalAlignment = 'Stretch' $scrollViewer.VerticalAlignment = 'Stretch' $scrollViewer.CanContentScroll = $true - $scrollViewer.Margin = 0 $itemsControl = New-Object Windows.Controls.ItemsControl $itemsControl.HorizontalAlignment = 'Stretch'