Fix Whitespace when using Search

This commit is contained in:
Marterich 2024-10-16 08:03:14 +02:00
parent 9dd89136e8
commit 80a933db8e

View File

@ -65,22 +65,21 @@ function Search-AppsByNameOrDescription {
} }
else { else {
$ItemsControl.Items | ForEach-Object { $ItemsControl.Items | ForEach-Object {
# Hide all CategoryWrapPanel and ToggleButton
$_.Visibility = [Windows.Visibility]::Collapsed
if ($_.Tag -like "CategoryWrapPanel_*") { if ($_.Tag -like "CategoryWrapPanel_*") {
$_.Visibility = [Windows.Visibility]::Visible
# Search for Apps that match the search string # Search for Apps that match the search string
$_.Children | Foreach-Object { $_.Children | Foreach-Object {
if ($sync.configs.applicationsHashtable.$($_.Tag).Content -like "*$SearchString*") { if ($sync.configs.applicationsHashtable.$($_.Tag).Content -like "*$SearchString*") {
# Show the App and the parent CategoryWrapPanel
$_.Visibility = [Windows.Visibility]::Visible $_.Visibility = [Windows.Visibility]::Visible
$_.parent.Visibility = [Windows.Visibility]::Visible
} }
else { else {
$_.Visibility = [Windows.Visibility]::Collapsed $_.Visibility = [Windows.Visibility]::Collapsed
} }
} }
} }
else {
# Hide all Category Labels
$_.Visibility = [Windows.Visibility]::Collapsed
}
} }
} }
} }
@ -254,7 +253,6 @@ function Invoke-WPFUIApps {
$scrollViewer.HorizontalAlignment = 'Stretch' $scrollViewer.HorizontalAlignment = 'Stretch'
$scrollViewer.VerticalAlignment = 'Stretch' $scrollViewer.VerticalAlignment = 'Stretch'
$scrollViewer.CanContentScroll = $true $scrollViewer.CanContentScroll = $true
$scrollViewer.Margin = 0
$itemsControl = New-Object Windows.Controls.ItemsControl $itemsControl = New-Object Windows.Controls.ItemsControl
$itemsControl.HorizontalAlignment = 'Stretch' $itemsControl.HorizontalAlignment = 'Stretch'