mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-24 11:55:31 +00:00
fix radiobuttons
This commit is contained in:
parent
7d90ab8660
commit
fdb156a450
@ -59,6 +59,8 @@ function Invoke-WPFUIElements {
|
||||
$configHashtable[$_] = $configVariable.$_
|
||||
}
|
||||
|
||||
$radioButtonGroups = @{}
|
||||
|
||||
$organizedData = @{}
|
||||
# Iterate through JSON data and organize by panel and category
|
||||
foreach ($entry in $configHashtable.Keys) {
|
||||
@ -483,6 +485,20 @@ function Invoke-WPFUIElements {
|
||||
}
|
||||
|
||||
"RadioButton" {
|
||||
# Check if a container for this GroupName already exists
|
||||
if (-not $radioButtonGroups.ContainsKey($entryInfo.GroupName)) {
|
||||
# Create a StackPanel for this group
|
||||
$groupStackPanel = New-Object Windows.Controls.StackPanel
|
||||
$groupStackPanel.Orientation = "Vertical"
|
||||
|
||||
# Add the group container to the ItemsControl
|
||||
$itemsControl.Items.Add($groupStackPanel) | Out-Null
|
||||
} else {
|
||||
# Retrieve the existing group container
|
||||
$groupStackPanel = $radioButtonGroups[$entryInfo.GroupName]
|
||||
}
|
||||
|
||||
# Create the RadioButton
|
||||
$radioButton = New-Object Windows.Controls.RadioButton
|
||||
$radioButton.Name = $entryInfo.Name
|
||||
$radioButton.GroupName = $entryInfo.GroupName
|
||||
@ -496,7 +512,8 @@ function Invoke-WPFUIElements {
|
||||
$radioButton.IsChecked = $true
|
||||
}
|
||||
|
||||
$itemsControl.Items.Add($radioButton) | Out-Null
|
||||
# Add the RadioButton to the group container
|
||||
$groupStackPanel.Children.Add($radioButton) | Out-Null
|
||||
$sync[$entryInfo.Name] = $radioButton
|
||||
}
|
||||
|
||||
|
@ -136,8 +136,8 @@ foreach ($category in $uniqueCategories) {
|
||||
|
||||
# Now call the function with the final merged config
|
||||
Invoke-WPFUIElements -configVariable $sync.configs.appnavigation -targetGridName "appscategory" -columncount 1
|
||||
|
||||
Invoke-WPFUIElements -configVariable $sync.configs.applications -targetGridName "appspanel" -columncount 1
|
||||
|
||||
Invoke-WPFUIElements -configVariable $sync.configs.tweaks -targetGridName "tweakspanel" -columncount 2
|
||||
Invoke-WPFUIElements -configVariable $sync.configs.feature -targetGridName "featurespanel" -columncount 2
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user