Style for Hidden Checkbox but visible Content

This commit is contained in:
Marterich 2024-10-14 20:46:28 +02:00
parent 8d34e2fa30
commit ba968d0cb3
2 changed files with 14 additions and 1 deletions

View File

@ -284,6 +284,7 @@ function Invoke-WPFUIApps {
$checkBox.HorizontalAlignment = "Left" $checkBox.HorizontalAlignment = "Left"
$checkBox.VerticalAlignment = "Center" $checkBox.VerticalAlignment = "Center"
$checkBox.Margin = New-Object Windows.Thickness(5, 0, 10, 0) $checkBox.Margin = New-Object Windows.Thickness(5, 0, 10, 0)
$checkBox.SetResourceReference([Windows.Controls.Control]::StyleProperty, "CollapsedCheckBoxStyle")
$checkbox.Add_Checked({ $checkbox.Add_Checked({
Invoke-WPFSelectedLabelUpdate -type "Add" -checkbox $this Invoke-WPFSelectedLabelUpdate -type "Add" -checkbox $this
$borderElement = $this.Parent.Parent $borderElement = $this.Parent.Parent

View File

@ -366,6 +366,19 @@
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style> </Style>
<!-- Collapsed Checkbox Style -->
<Style x:Key="CollapsedCheckBoxStyle" TargetType="CheckBox">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CheckBox">
<ContentPresenter Content="{TemplateBinding Content}"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Margin="{TemplateBinding Padding}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="RadioButton"> <Style TargetType="RadioButton">
<Setter Property="Foreground" Value="{DynamicResource MainForegroundColor}"/> <Setter Property="Foreground" Value="{DynamicResource MainForegroundColor}"/>
<Setter Property="Background" Value="{DynamicResource MainBackgroundColor}"/> <Setter Property="Background" Value="{DynamicResource MainBackgroundColor}"/>
@ -864,7 +877,6 @@
</Border> </Border>
</Popup> </Popup>
<Button Name="SettingsButton" <Button Name="SettingsButton"
Style="{StaticResource HoverButtonStyle}" Style="{StaticResource HoverButtonStyle}"
Grid.Column="3" BorderBrush="Transparent" Grid.Column="3" BorderBrush="Transparent"