mirror of
https://github.com/ChrisTitusTech/winutil
synced 2026-04-05 22:28:31 +00:00
Content-based Automatic Sorting (#4022)
* Implement Auto-sorting instead of manually defining order * ffix visual bugs
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user