feat: make button color targets template part.

This commit is contained in:
rabbitism 2024-03-20 21:00:11 +08:00
parent 6df8ea2101
commit 2470522209

View File

@ -70,17 +70,17 @@
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDangerForeground}" />
</Style>
<Style Selector="^:pointerover">
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultPointeroverBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPointeroverBackground}" />
</Style>
<Style Selector="^:pressed">
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultPressedBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ButtonDefaultPressedBackground}" />
</Style>
<Style Selector="^:disabled">
<Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultDisabledBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource ButtonDefaultDisabledBackground}" />
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
@ -100,49 +100,57 @@
x:Key="SolidButton"
BasedOn="{StaticResource {x:Type Button}}"
TargetType="Button">
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Button.Foreground" Value="{DynamicResource ButtonSolidForeground}" />
<Setter Property="Button.Background" Value="{DynamicResource ButtonSolidPrimaryBackground}" />
<Setter Property="Button.BorderBrush" Value="{DynamicResource ButtonSolidPrimaryBorderBrush}" />
</Style>
<Style Selector="^:pointerover">
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryPointeroverBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidPrimaryPointeroverBorderBrush}" />
</Style>
<Style Selector="^:pressed">
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryPressedBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidPrimaryPressedBorderBrush}" />
</Style>
<Style Selector="^.Primary">
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidPrimaryBorderBrush}" />
<Style Selector="^:pointerover">
</Style>
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryPointeroverBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidPrimaryPointeroverBorderBrush}" />
</Style>
<Style Selector="^:pressed">
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryPressedBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidPrimaryPressedBorderBrush}" />
</Style>
</Style>
<Style Selector="^.Secondary">
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
<Setter Property="Background" Value="{DynamicResource ButtonSolidSecondaryBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidSecondaryBorderBrush}" />
<Style Selector="^:pointerover">
</Style>
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonSolidSecondaryPointeroverBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidSecondaryPointeroverBorderBrush}" />
</Style>
<Style Selector="^:pressed">
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ButtonSolidSecondaryPressedBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidSecondaryPressedBorderBrush}" />
</Style>
</Style>
<Style Selector="^.Tertiary">
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
<Setter Property="Background" Value="{DynamicResource ButtonSolidTertiaryBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidTertiaryBorderBrush}" />
</Style>
<Style Selector="^:pointerover">
<Setter Property="Background" Value="{DynamicResource ButtonSolidTertiaryPointeroverBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidTertiaryPointeroverBorderBrush}" />
@ -153,9 +161,11 @@
</Style>
</Style>
<Style Selector="^.Success">
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
<Setter Property="Background" Value="{DynamicResource ButtonSolidSuccessBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidSuccessBorderBrush}" />
</Style>
<Style Selector="^:pointerover">
<Setter Property="Background" Value="{DynamicResource ButtonSolidSuccessPointeroverBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidSuccessPointeroverBorderBrush}" />
@ -166,9 +176,11 @@
</Style>
</Style>
<Style Selector="^.Warning">
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
<Setter Property="Background" Value="{DynamicResource ButtonSolidWarningBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidWarningBorderBrush}" />
</Style>
<Style Selector="^:pointerover">
<Setter Property="Background" Value="{DynamicResource ButtonSolidWarningPointeroverBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidWarningPointeroverBorderBrush}" />
@ -179,9 +191,11 @@
</Style>
</Style>
<Style Selector="^.Danger">
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
<Setter Property="Background" Value="{DynamicResource ButtonSolidDangerBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidDangerBorderBrush}" />
</Style>
<Style Selector="^:pointerover">
<Setter Property="Background" Value="{DynamicResource ButtonSolidDangerPointeroverBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonSolidDangerPointeroverBorderBrush}" />
@ -203,9 +217,11 @@
x:Key="BorderlessButton"
BasedOn="{StaticResource {x:Type Button}}"
TargetType="Button">
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Button.Background" Value="Transparent" />
<Setter Property="Button.BorderBrush" Value="Transparent" />
<Style Selector="^:disabled">
</Style>
<Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />