mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-07-01 10:32:35 -05:00
Togglebutton fixes
- move dot to the right in style - cleanup code - fix arrangement of content
This commit is contained in:
@ -121,7 +121,7 @@ function Show-OnlyCheckedApps {
|
||||
$_.Content = "Show Selected"
|
||||
}
|
||||
Set-CategoryVisibility -Category "*" -ItemsControl $ItemsControl -automaticVisibility
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-WPFUIApps {
|
||||
|
@ -194,29 +194,16 @@ function Invoke-WPFUIElements {
|
||||
}
|
||||
|
||||
"ToggleButton" {
|
||||
# Determine contentOn and contentOff based on the Content property
|
||||
if ($entryInfo.Content -is [array]) {
|
||||
# If Content is an array, use its elements
|
||||
write-host "Content is an array"
|
||||
write-host $entryInfo.Content
|
||||
$contentOn = if ($entryInfo.Content.Count -ge 1) { $entryInfo.Content[0] } else { "" }
|
||||
$contentOff = if ($entryInfo.Content.Count -ge 2) { $entryInfo.Content[1] } else { $contentOn }
|
||||
} else {
|
||||
# If Content is a single value, use it for both states
|
||||
$contentOn = $entryInfo.Content
|
||||
$contentOff = $entryInfo.Content
|
||||
}
|
||||
|
||||
$toggleButton = New-Object Windows.Controls.Primitives.ToggleButton
|
||||
$toggleButton.Name = $entryInfo.Name
|
||||
$toggleButton.Content = $contentOff
|
||||
$toggleButton.Content = $entryInfo.Content[1]
|
||||
$toggleButton.ToolTip = $entryInfo.Description
|
||||
$toggleButton.HorizontalAlignment = "Left"
|
||||
$toggleButton.Style = $ToggleButtonStyle
|
||||
|
||||
$toggleButton.Tag = @{
|
||||
contentOn = $contentOn
|
||||
contentOff = $contentOff
|
||||
contentOn = if ($entryInfo.Content.Count -ge 1) { $entryInfo.Content[0] } else { "" }
|
||||
contentOff = if ($entryInfo.Content.Count -ge 2) { $entryInfo.Content[1] } else { $contentOn }
|
||||
}
|
||||
|
||||
$itemsControl.Items.Add($toggleButton) | Out-Null
|
||||
|
Reference in New Issue
Block a user