mirror of
https://gitee.com/handyorg/HandyControl.git
synced 2024-11-29 18:38:30 +08:00
chore: add avalonia DashedButton demo.
This commit is contained in:
parent
a6c4f7b2f3
commit
ed5ce0a913
@ -63,6 +63,62 @@
|
||||
Theme="{StaticResource ButtonDanger}" />
|
||||
</StackPanel>
|
||||
</WrapPanel>
|
||||
<WrapPanel>
|
||||
<StackPanel>
|
||||
<Button Content="default"
|
||||
Margin="5"
|
||||
Theme="{StaticResource ButtonDashed}" />
|
||||
<Button IsEnabled="False"
|
||||
Content="default"
|
||||
Margin="5"
|
||||
Theme="{StaticResource ButtonDashed}" />
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<Button Content="primary"
|
||||
Margin="5"
|
||||
Theme="{StaticResource ButtonDashedPrimary}" />
|
||||
<Button IsEnabled="False"
|
||||
Content="primary"
|
||||
Margin="5"
|
||||
Theme="{StaticResource ButtonDashedPrimary}" />
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<Button Content="success"
|
||||
Margin="5"
|
||||
Theme="{StaticResource ButtonDashedSuccess}" />
|
||||
<Button IsEnabled="False"
|
||||
Content="success"
|
||||
Margin="5"
|
||||
Theme="{StaticResource ButtonDashedSuccess}" />
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<Button Content="info"
|
||||
Margin="5"
|
||||
Theme="{StaticResource ButtonDashedInfo}" />
|
||||
<Button IsEnabled="False"
|
||||
Content="info"
|
||||
Margin="5"
|
||||
Theme="{StaticResource ButtonDashedInfo}" />
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<Button Content="warning"
|
||||
Margin="5"
|
||||
Theme="{StaticResource ButtonDashedWarning}" />
|
||||
<Button IsEnabled="False"
|
||||
Content="warning"
|
||||
Margin="5"
|
||||
Theme="{StaticResource ButtonDashedWarning}" />
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<Button Content="danger"
|
||||
Margin="5"
|
||||
Theme="{StaticResource ButtonDashedDanger}" />
|
||||
<Button IsEnabled="False"
|
||||
Content="danger"
|
||||
Margin="5"
|
||||
Theme="{StaticResource ButtonDashedDanger}" />
|
||||
</StackPanel>
|
||||
</WrapPanel>
|
||||
</hc:UniformSpacingPanel>
|
||||
</hc:UniformSpacingPanel>
|
||||
</ScrollViewer>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol">
|
||||
<ControlTheme x:Key="ButtonBaseStyle"
|
||||
TargetType="Button">
|
||||
<Setter Property="Height"
|
||||
@ -40,34 +41,60 @@
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
||||
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Style Selector="^:pointerover">
|
||||
<Setter Property="Opacity"
|
||||
Value="0.9" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Style Selector="^:pressed">
|
||||
<Setter Property="Opacity"
|
||||
Value="0.6" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Style Selector="^:disabled">
|
||||
<Setter Property="Opacity"
|
||||
Value="0.4" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="ButtonDashedBaseStyle"
|
||||
BasedOn="{StaticResource ButtonBaseStyle}"
|
||||
TargetType="Button">
|
||||
<Setter Property="Background"
|
||||
Value="Transparent" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<hc:DashedBorder BorderDashArray="3,2"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<ContentPresenter x:Name="PART_ContentPresenter"
|
||||
Background="{TemplateBinding Background}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
RecognizesAccessKey="True"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
|
||||
</hc:DashedBorder>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="ButtonDefault"
|
||||
BasedOn="{StaticResource ButtonBaseStyle}"
|
||||
TargetType="Button">
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource PrimaryTextBrush}" />
|
||||
|
||||
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Style Selector="^:pointerover">
|
||||
<Setter Property="Background"
|
||||
Value="{DynamicResource SecondaryRegionBrush}" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Style Selector="^:pressed">
|
||||
<Setter Property="Background"
|
||||
Value="{DynamicResource BorderBrush}" />
|
||||
</Style>
|
||||
@ -121,4 +148,63 @@
|
||||
<Setter Property="BorderBrush"
|
||||
Value="{DynamicResource DangerBrush}" />
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="ButtonDashed"
|
||||
BasedOn="{StaticResource ButtonDashedBaseStyle}"
|
||||
TargetType="Button">
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource PrimaryTextBrush}" />
|
||||
|
||||
<Style Selector="^:pointerover">
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource PrimaryBrush}" />
|
||||
<Setter Property="BorderBrush"
|
||||
Value="{DynamicResource PrimaryBrush}" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="ButtonDashedPrimary"
|
||||
BasedOn="{StaticResource ButtonDashedBaseStyle}"
|
||||
TargetType="Button">
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource PrimaryBrush}" />
|
||||
<Setter Property="BorderBrush"
|
||||
Value="{DynamicResource PrimaryBrush}" />
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="ButtonDashedSuccess"
|
||||
BasedOn="{StaticResource ButtonDashedBaseStyle}"
|
||||
TargetType="Button">
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource SuccessBrush}" />
|
||||
<Setter Property="BorderBrush"
|
||||
Value="{DynamicResource SuccessBrush}" />
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="ButtonDashedInfo"
|
||||
BasedOn="{StaticResource ButtonDashedBaseStyle}"
|
||||
TargetType="Button">
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource InfoBrush}" />
|
||||
<Setter Property="BorderBrush"
|
||||
Value="{DynamicResource InfoBrush}" />
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="ButtonDashedWarning"
|
||||
BasedOn="{StaticResource ButtonDashedBaseStyle}"
|
||||
TargetType="Button">
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource WarningBrush}" />
|
||||
<Setter Property="BorderBrush"
|
||||
Value="{DynamicResource WarningBrush}" />
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="ButtonDashedDanger"
|
||||
BasedOn="{StaticResource ButtonDashedBaseStyle}"
|
||||
TargetType="Button">
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource DangerBrush}" />
|
||||
<Setter Property="BorderBrush"
|
||||
Value="{DynamicResource DangerBrush}" />
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
||||
|
@ -38,7 +38,7 @@
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
||||
<Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Style Selector="^:disabled">
|
||||
<Setter Property="Opacity"
|
||||
Value="0.4" />
|
||||
</Style>
|
||||
|
@ -40,17 +40,17 @@
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
||||
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Style Selector="^:pointerover">
|
||||
<Setter Property="Opacity"
|
||||
Value="0.9" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Style Selector="^:pressed">
|
||||
<Setter Property="Opacity"
|
||||
Value="0.6" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Style Selector="^:disabled">
|
||||
<Setter Property="Opacity"
|
||||
Value="0.4" />
|
||||
</Style>
|
||||
@ -62,12 +62,12 @@
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource PrimaryTextBrush}" />
|
||||
|
||||
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Style Selector="^:pointerover">
|
||||
<Setter Property="Background"
|
||||
Value="{DynamicResource SecondaryRegionBrush}" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Style Selector="^:pressed">
|
||||
<Setter Property="Background"
|
||||
Value="{DynamicResource BorderBrush}" />
|
||||
</Style>
|
||||
|
@ -38,12 +38,12 @@
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
||||
<Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Style Selector="^:disabled">
|
||||
<Setter Property="Opacity"
|
||||
Value="0.4" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:selected /template/ ContentPresenter#PART_ContentPresenter">
|
||||
<Style Selector="^:selected">
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource PrimaryBrush}" />
|
||||
</Style>
|
||||
|
Loading…
Reference in New Issue
Block a user