Content-based Automatic Sorting (#4022)

* Implement Auto-sorting instead of manually defining order

* ffix visual bugs
This commit is contained in:
Eren
2026-02-11 18:28:09 +03:00
committed by GitHub
parent aaed116798
commit b2ccb3669b
2 changed files with 8 additions and 61 deletions

View File

@@ -69,7 +69,6 @@ function Invoke-WPFUIElements {
# Create an object for the application
$entryObject = [PSCustomObject]@{
Name = $entry
Order = $entryInfo.order
Category = $entryInfo.Category
Content = $entryInfo.Content
Panel = if ($entryInfo.Panel) { $entryInfo.Panel } else { "0" }
@@ -144,8 +143,14 @@ function Invoke-WPFUIElements {
$itemsControl.Items.Add($label) | Out-Null
$sync[$category] = $label
# Sort entries by Order and then by Name
$entries = $organizedData[$panelKey][$category] | Sort-Object Order, Name
# Sort entries by type (checkboxes first, then buttons, then comboboxes) and then alphabetically by Content
$entries = $organizedData[$panelKey][$category] | Sort-Object @{Expression = {
switch ($_.Type) {
'Button' { 1 }
'Combobox' { 2 }
default { 0 }
}
}}, Content
foreach ($entryInfo in $entries) {
$count++
# Create the UI elements based on the entry type