mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-14 22:55:52 -06:00
Togglebutton fixes
- move dot to the right in style - cleanup code - fix arrangement of content
This commit is contained in:
parent
fd4d783a04
commit
c0d6e0bbc7
@ -7,7 +7,7 @@
|
||||
"Description": "Toggle between a list and a compact grid like view"
|
||||
},
|
||||
"WPFSelectedFilter": {
|
||||
"Content": ["Show Selected", "Show All"],
|
||||
"Content": [ "Show All", "Show Selected"],
|
||||
"Category": "____Actions",
|
||||
"Type": "ToggleButton",
|
||||
"Order": "2",
|
||||
|
@ -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
|
||||
|
@ -358,11 +358,11 @@
|
||||
<Grid>
|
||||
<!-- Toggle Dot -->
|
||||
<Ellipse x:Name="ToggleDot"
|
||||
Width="8" Height="8"
|
||||
Fill="{DynamicResource ButtonForegroundColor}"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Margin="5,3,0,0" />
|
||||
Width="8" Height="8"
|
||||
Fill="{DynamicResource ButtonForegroundColor}"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Margin="0,3,5,0" />
|
||||
|
||||
<!-- Content Presenter -->
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10,2,10,2"/>
|
||||
@ -374,7 +374,7 @@
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter TargetName="ToggleDot" Property="VerticalAlignment" Value="Bottom"/>
|
||||
<Setter TargetName="ToggleDot" Property="Margin" Value="5,0,0,3"/> <!-- Consistent bottom margin -->
|
||||
<Setter TargetName="ToggleDot" Property="Margin" Value="0,0,5,3"/> <!-- Consistent bottom margin on the right -->
|
||||
</Trigger>
|
||||
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
|
Loading…
Reference in New Issue
Block a user