Files
winutil/functions/private/Update-WinUtilAppCategoryChip.ps1
T
MyDriftandGitHub 32ab9f0ab0 Turn the Install category filters into toggle chips (#4926)
* Turn the Install category filters into toggle chips

- Replace the filter buttons with toggles that show which ones are active
- Add ctrl click to select more than one category
- Keep the search box and the category filter independent of each other
- Expand matching categories while a filter is active

* Fix the filter interactions the category chips missed

- Pass the selected categories to the lazy rendering batches, the old call
  used a parameter that no longer exists and threw while typing
- Keep the category filter when switching tabs, the chips stayed checked
  while the filter itself was dropped
- Put a category back to collapsed once the filter that expanded it is gone

* Document the Install category filters

- Add a guide section for the chips, ctrl click and clearing the filter
- Note that search and the category chips apply together

* Correct the category filter guide wording

- Clearing by clicking the chip only applies when it is the only one selected
- Only categories with matches expand, and only auto expanded ones re-collapse
2026-08-09 13:13:21 -05:00

20 lines
741 B
PowerShell

function Update-WinUtilAppCategoryChip {
<#
.SYNOPSIS
Pushes the current category selection onto the Install tab filter chips
.DESCRIPTION
The chips are toggle buttons, so their checked state has to follow the selection
rather than whatever the last click did to them. The All chip is checked when no
category is selected.
#>
$selected = $sync.SelectedAppCategories
if ($null -eq $selected) { return }
foreach ($chip in $sync.AppCategoryChips) {
$control = $sync[$chip.Name]
if ($null -eq $control) { continue }
$control.IsChecked = if ($chip.Category) { $selected.Contains($chip.Category) } else { $selected.Count -eq 0 }
}
}