enhance: avalonia HyperlinkButton style.

This commit is contained in:
NaBian committed 2025-10-14 21:29:59 +08:00
1 parent 64da563916
commit fb2784f1d2
2 files changed
+152 -8

No files matched your search

@@ -17,28 +17,27 @@
IsEnabled="False" /> IsEnabled="False" />
<HyperlinkButton Content="HandyControl" <HyperlinkButton Content="HandyControl"
Classes="ghost" Theme="{StaticResource HyperlinkButtonGhost}"
NavigateUri="https://github.com/HandyOrg/HandyControl" /> NavigateUri="https://github.com/HandyOrg/HandyControl" />
<HyperlinkButton Content="HandyControl" <HyperlinkButton Content="HandyControl"
Classes="ghost primary" Theme="{StaticResource HyperlinkButtonGhostPrimary}"
NavigateUri="https://github.com/HandyOrg/HandyControl" /> NavigateUri="https://github.com/HandyOrg/HandyControl" />
<HyperlinkButton Content="HandyControl" <HyperlinkButton Content="HandyControl"
Classes="ghost success" Theme="{StaticResource HyperlinkButtonGhostSuccess}"
NavigateUri="https://github.com/HandyOrg/HandyControl" /> NavigateUri="https://github.com/HandyOrg/HandyControl" />
<HyperlinkButton Content="HandyControl" <HyperlinkButton Content="HandyControl"
Classes="ghost info" Theme="{StaticResource HyperlinkButtonGhostInfo}"
NavigateUri="https://github.com/HandyOrg/HandyControl" /> NavigateUri="https://github.com/HandyOrg/HandyControl" />
<HyperlinkButton Content="HandyControl" <HyperlinkButton Content="HandyControl"
Classes="ghost warning" Theme="{StaticResource HyperlinkButtonGhostWarning}"
NavigateUri="https://github.com/HandyOrg/HandyControl" /> NavigateUri="https://github.com/HandyOrg/HandyControl" />
<HyperlinkButton Content="HandyControl" <HyperlinkButton Content="HandyControl"
Classes="ghost danger" Theme="{StaticResource HyperlinkButtonGhostDanger}"
NavigateUri="https://github.com/HandyOrg/HandyControl" /> NavigateUri="https://github.com/HandyOrg/HandyControl" />
</hc:UniformSpacingPanel> </hc:UniformSpacingPanel>
</Border> </Border>
<Border Theme="{StaticResource BorderRegion}"> <Border Theme="{StaticResource BorderRegion}">
<hc:UniformSpacingPanel Spacing="16"+ <hc:UniformSpacingPanel Spacing="16"
Orientation="Vertical"> Orientation="Vertical">
<HyperlinkButton Content="HandyControl" <HyperlinkButton Content="HandyControl"
Classes="small" Classes="small"
@@ -48,6 +47,9 @@
NavigateUri="https://github.com/HandyOrg/HandyControl" NavigateUri="https://github.com/HandyOrg/HandyControl"
IsEnabled="False" /> IsEnabled="False" />
<HyperlinkButton Content="HandyControl"
Classes="ghost small"
NavigateUri="https://github.com/HandyOrg/HandyControl" />
<HyperlinkButton Content="HandyControl" <HyperlinkButton Content="HandyControl"
Classes="ghost primary small" Classes="ghost primary small"
NavigateUri="https://github.com/HandyOrg/HandyControl" /> NavigateUri="https://github.com/HandyOrg/HandyControl" />
@@ -66,8 +66,150 @@
</Style> </Style>
</ControlTheme> </ControlTheme>
<ControlTheme x:Key="HyperlinkButtonDefault"
BasedOn="{StaticResource HyperlinkButtonBaseStyle}"
TargetType="HyperlinkButton" />
<ControlTheme x:Key="HyperlinkButtonDefault.Small"
BasedOn="{StaticResource HyperlinkButtonBaseStyle}"
TargetType="HyperlinkButton">
<Setter Property="Height"
Value="20" />
<Setter Property="Padding"
Value="6,1" />
<Setter Property="hc:IconElement.Height"
Value="12" />
</ControlTheme>
<ControlTheme x:Key="{x:Type HyperlinkButton}" <ControlTheme x:Key="{x:Type HyperlinkButton}"
BasedOn="{StaticResource HyperlinkButtonBaseStyle}" BasedOn="{StaticResource HyperlinkButtonBaseStyle}"
TargetType="HyperlinkButton" /> TargetType="HyperlinkButton" />
<ControlTheme x:Key="HyperlinkButtonGhost"
BasedOn="{StaticResource HyperlinkButtonBaseStyle}"
TargetType="HyperlinkButton">
<Setter Property="hc:BackgroundSwitchElement.MouseHoverBackground"
Value="{DynamicResource SecondaryRegionBrush}" />
<Setter Property="hc:BackgroundSwitchElement.MouseHoverForeground"
Value="{DynamicResource PrimaryTextBrush}" />
<Style Selector="^:pointerover">
<Setter Property="Background"
Value="{Binding $self.(hc:BackgroundSwitchElement.MouseHoverBackground)}" />
<Setter Property="Foreground"
Value="{Binding $self.(hc:BackgroundSwitchElement.MouseHoverForeground)}" />
</Style>
</ControlTheme>
<ControlTheme x:Key="HyperlinkButtonGhost.Small"
BasedOn="{StaticResource HyperlinkButtonGhost}"
TargetType="HyperlinkButton">
<Setter Property="Height"
Value="20" />
<Setter Property="Padding"
Value="6,1" />
<Setter Property="hc:IconElement.Height"
Value="12" />
</ControlTheme>
<ControlTheme x:Key="HyperlinkButtonGhostPrimary"
BasedOn="{StaticResource HyperlinkButtonGhost}"
TargetType="HyperlinkButton">
<Setter Property="hc:BackgroundSwitchElement.MouseHoverBackground"
Value="{DynamicResource PrimaryBrush}" />
<Setter Property="hc:BackgroundSwitchElement.MouseHoverForeground"
Value="{DynamicResource TextIconBrush}" />
</ControlTheme>
<ControlTheme x:Key="HyperlinkButtonGhostPrimary.Small"
BasedOn="{StaticResource HyperlinkButtonGhostPrimary}"
TargetType="HyperlinkButton">
<Setter Property="Height"
Value="20" />
<Setter Property="Padding"
Value="6,1" />
<Setter Property="hc:IconElement.Height"
Value="12" />
</ControlTheme>
<ControlTheme x:Key="HyperlinkButtonGhostSuccess"
BasedOn="{StaticResource HyperlinkButtonGhost}"
TargetType="HyperlinkButton">
<Setter Property="hc:BackgroundSwitchElement.MouseHoverBackground"
Value="{DynamicResource SuccessBrush}" />
<Setter Property="hc:BackgroundSwitchElement.MouseHoverForeground"
Value="{DynamicResource TextIconBrush}" />
</ControlTheme>
<ControlTheme x:Key="HyperlinkButtonGhostSuccess.Small"
BasedOn="{StaticResource HyperlinkButtonGhostSuccess}"
TargetType="HyperlinkButton">
<Setter Property="Height"
Value="20" />
<Setter Property="Padding"
Value="6,1" />
<Setter Property="hc:IconElement.Height"
Value="12" />
</ControlTheme>
<ControlTheme x:Key="HyperlinkButtonGhostInfo"
BasedOn="{StaticResource HyperlinkButtonGhost}"
TargetType="HyperlinkButton">
<Setter Property="hc:BackgroundSwitchElement.MouseHoverBackground"
Value="{DynamicResource InfoBrush}" />
<Setter Property="hc:BackgroundSwitchElement.MouseHoverForeground"
Value="{DynamicResource TextIconBrush}" />
</ControlTheme>
<ControlTheme x:Key="HyperlinkButtonGhostInfo.Small"
BasedOn="{StaticResource HyperlinkButtonGhostInfo}"
TargetType="HyperlinkButton">
<Setter Property="Height"
Value="20" />
<Setter Property="Padding"
Value="6,1" />
<Setter Property="hc:IconElement.Height"
Value="12" />
</ControlTheme>
<ControlTheme x:Key="HyperlinkButtonGhostWarning"
BasedOn="{StaticResource HyperlinkButtonGhost}"
TargetType="HyperlinkButton">
<Setter Property="hc:BackgroundSwitchElement.MouseHoverBackground"
Value="{DynamicResource WarningBrush}" />
<Setter Property="hc:BackgroundSwitchElement.MouseHoverForeground"
Value="{DynamicResource TextIconBrush}" />
</ControlTheme>
<ControlTheme x:Key="HyperlinkButtonGhostWarning.Small"
BasedOn="{StaticResource HyperlinkButtonGhostWarning}"
TargetType="HyperlinkButton">
<Setter Property="Height"
Value="20" />
<Setter Property="Padding"
Value="6,1" />
<Setter Property="hc:IconElement.Height"
Value="12" />
</ControlTheme>
<ControlTheme x:Key="HyperlinkButtonGhostDanger"
BasedOn="{StaticResource HyperlinkButtonGhost}"
TargetType="HyperlinkButton">
<Setter Property="hc:BackgroundSwitchElement.MouseHoverBackground"
Value="{DynamicResource DangerBrush}" />
<Setter Property="hc:BackgroundSwitchElement.MouseHoverForeground"
Value="{DynamicResource TextIconBrush}" />
</ControlTheme>
<ControlTheme x:Key="HyperlinkButtonGhostDanger.Small"
BasedOn="{StaticResource HyperlinkButtonGhostDanger}"
TargetType="HyperlinkButton">
<Setter Property="Height"
Value="20" />
<Setter Property="Padding"
Value="6,1" />
<Setter Property="hc:IconElement.Height"
Value="12" />
</ControlTheme>
</ResourceDictionary> </ResourceDictionary>