misc: swap SimpleToggleSwitch & ButtonToggleSwitch.

This commit is contained in:
Zhang Dian 2024-11-29 23:24:07 +08:00
parent 266fdade35
commit b4d5a3f932

View File

@ -18,7 +18,7 @@
<Setter Property="FocusAdorner">
<FocusAdornerTemplate>
<Border Theme="{DynamicResource AdornerLayerBorder}"
CornerRadius="{DynamicResource ToggleSwitchIndicatorCornerRadius}"/>
CornerRadius="{DynamicResource ToggleSwitchIndicatorCornerRadius}" />
</FocusAdornerTemplate>
</Setter>
<Setter Property="KnobTransitions">
@ -34,7 +34,7 @@
<Grid
Background="{TemplateBinding Background}"
Cursor="Hand"
RowDefinitions="Auto,*"
RowDefinitions="Auto, *"
ColumnDefinitions="Auto, *">
<ContentPresenter
Name="PART_ContentPresenter"
@ -208,7 +208,7 @@
<Style Selector="^ /template/ Grid#PART_MovingKnobs">
<Setter Property="Width" Value="{DynamicResource ToggleSwitchIndicatorSmallWidth}" />
<Setter Property="Height" Value="{DynamicResource ToggleSwitchIndicatorSmallWidth}" />
<Setter Property="Margin" Value="{DynamicResource ToggleSwitchIndicatorSmallMargin}"/>
<Setter Property="Margin" Value="{DynamicResource ToggleSwitchIndicatorSmallMargin}" />
</Style>
<Style Selector="^ /template/ Arc#SwitchKnobLoadingIndicator">
<Setter Property="StrokeThickness" Value="{DynamicResource ToggleSwitchLoadingIndicatorSmallStrokeThickness}" />
@ -226,7 +226,7 @@
<Style Selector="^ /template/ Grid#PART_MovingKnobs">
<Setter Property="Width" Value="{DynamicResource ToggleSwitchIndicatorLargeWidth}" />
<Setter Property="Height" Value="{DynamicResource ToggleSwitchIndicatorLargeWidth}" />
<Setter Property="Margin" Value="{DynamicResource ToggleSwitchIndicatorLargeMargin}"/>
<Setter Property="Margin" Value="{DynamicResource ToggleSwitchIndicatorLargeMargin}" />
</Style>
<Style Selector="^ /template/ Arc#SwitchKnobLoadingIndicator">
<Setter Property="StrokeThickness" Value="{DynamicResource ToggleSwitchLoadingIndicatorLargeStrokeThickness}" />
@ -234,51 +234,6 @@
</Style>
</ControlTheme>
<ControlTheme
x:Key="ButtonToggleSwitch"
BasedOn="{StaticResource {x:Type ToggleSwitch}}"
TargetType="ToggleSwitch">
<Setter Property="Padding" Value="8" />
<Setter Property="CornerRadius" Value="3" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="FocusAdorner">
<FocusAdornerTemplate>
<Border Theme="{StaticResource AdornerLayerBorder}" />
</FocusAdornerTemplate>
</Setter>
<Setter Property="Template">
<ControlTemplate TargetType="ToggleSwitch">
<Border
Name="Background"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
CornerRadius="{TemplateBinding CornerRadius}"
Cursor="Hand">
<Panel>
<Panel Name="PART_SwitchKnob" />
<Panel Name="PART_MovingKnobs" />
<ContentPresenter
Name="PART_OnContentPresenter"
Margin="{DynamicResource ToggleSwitchOnContentMargin}"
Content="{TemplateBinding OnContent}"
ContentTemplate="{TemplateBinding OnContentTemplate}" />
<ContentPresenter
Name="PART_OffContentPresenter"
Margin="{DynamicResource ToggleSwitchOnContentMargin}"
Content="{TemplateBinding OffContent}"
ContentTemplate="{TemplateBinding OffContentTemplate}" />
</Panel>
</Border>
</ControlTemplate>
</Setter>
<Style Selector="^:pointerover">
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPointeroverBackground}" />
</Style>
<Style Selector="^:pressed">
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPressedBackground}" />
</Style>
</ControlTheme>
<ControlTheme
x:Key="SimpleToggleSwitch"
BasedOn="{StaticResource {x:Type ToggleSwitch}}"
@ -391,4 +346,49 @@
</Style>
</Style>
</ControlTheme>
<ControlTheme
x:Key="ButtonToggleSwitch"
BasedOn="{StaticResource {x:Type ToggleSwitch}}"
TargetType="ToggleSwitch">
<Setter Property="Padding" Value="8" />
<Setter Property="CornerRadius" Value="3" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="FocusAdorner">
<FocusAdornerTemplate>
<Border Theme="{StaticResource AdornerLayerBorder}" />
</FocusAdornerTemplate>
</Setter>
<Setter Property="Template">
<ControlTemplate TargetType="ToggleSwitch">
<Border
Name="Background"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
CornerRadius="{TemplateBinding CornerRadius}"
Cursor="Hand">
<Panel>
<Panel Name="PART_SwitchKnob" />
<Panel Name="PART_MovingKnobs" />
<ContentPresenter
Name="PART_OnContentPresenter"
Margin="{DynamicResource ToggleSwitchOnContentMargin}"
Content="{TemplateBinding OnContent}"
ContentTemplate="{TemplateBinding OnContentTemplate}" />
<ContentPresenter
Name="PART_OffContentPresenter"
Margin="{DynamicResource ToggleSwitchOnContentMargin}"
Content="{TemplateBinding OffContent}"
ContentTemplate="{TemplateBinding OffContentTemplate}" />
</Panel>
</Border>
</ControlTemplate>
</Setter>
<Style Selector="^:pointerover">
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPointeroverBackground}" />
</Style>
<Style Selector="^:pressed">
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPressedBackground}" />
</Style>
</ControlTheme>
</ResourceDictionary>