feat: add :pointerover and :pressed style

This commit is contained in:
Zhang Dian
2023-02-23 21:28:33 +08:00
parent c8e58e3dbf
commit 6af2d9008d

View File

@@ -172,9 +172,14 @@
<ControlTheme x:Key="ButtonToggleSwitch" BasedOn="{StaticResource {x:Type ToggleSwitch}}" TargetType="ToggleSwitch"> <ControlTheme x:Key="ButtonToggleSwitch" BasedOn="{StaticResource {x:Type ToggleSwitch}}" TargetType="ToggleSwitch">
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate TargetType="ToggleSwitch"> <ControlTemplate TargetType="ToggleSwitch">
<Border
Name="Background"
Cursor="Hand"
Padding="8"
Background="{TemplateBinding Background}"
CornerRadius="3">
<Grid <Grid
Background="Transparent" Background="Transparent"
Cursor="Hand"
ColumnDefinitions="Auto"> ColumnDefinitions="Auto">
<Grid x:Name="PART_SwitchKnob" /> <Grid x:Name="PART_SwitchKnob" />
<Grid x:Name="PART_MovingKnobs" /> <Grid x:Name="PART_MovingKnobs" />
@@ -189,8 +194,15 @@
Content="{TemplateBinding OffContent}" Content="{TemplateBinding OffContent}"
ContentTemplate="{TemplateBinding OffContentTemplate}" /> ContentTemplate="{TemplateBinding OffContentTemplate}" />
</Grid> </Grid>
</Border>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
<Style Selector="^:pointerover">
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPointeroverBackground}" />
</Style>
<Style Selector="^:pressed">
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPressedBackground}" />
</Style>
</ControlTheme> </ControlTheme>
<ControlTheme x:Key="SimpleToggleSwitch" BasedOn="{StaticResource {x:Type ToggleSwitch}}" TargetType="ToggleSwitch"> <ControlTheme x:Key="SimpleToggleSwitch" BasedOn="{StaticResource {x:Type ToggleSwitch}}" TargetType="ToggleSwitch">