roughly comp

This commit is contained in:
qile.wang 2024-02-28 15:51:30 +08:00
parent d19cc9d7b9
commit 386a3d297c
3 changed files with 112 additions and 43 deletions

View File

@ -17,6 +17,18 @@
VerticalAlignment="Center" /> VerticalAlignment="Center" />
</HyperlinkButton> </HyperlinkButton>
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal">
<HyperlinkButton
Height="30"
IsEnabled="False"
NavigateUri="http://www.irihi.tech/">
<TextBlock
HorizontalAlignment="Center"
Text="Not Enabled"
TextDecorations="Underline"
VerticalAlignment="Center" />
</HyperlinkButton>
</StackPanel>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<HyperlinkButton <HyperlinkButton
BorderThickness="1" BorderThickness="1"

View File

@ -32,45 +32,6 @@
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
<Style Selector="^.WithIcon">
<Setter Property="Template">
<ControlTemplate TargetType="HyperlinkButton">
<Grid
ColumnDefinitions="Auto,*"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
x:Name="RootGrid">
<Grid Grid.Column="0" VerticalAlignment="Top">
<Border
Background="{DynamicResource CheckBoxDefaultBackground}"
Height="{DynamicResource HyperlinkButtonIconHeight}"
Opacity="0"
UseLayoutRounding="False"
Width="{DynamicResource HyperlinkButtonIconWidth}"
x:Name="BackgroundRectangle" />
<!-- <PathIcon -->
<!-- Data="{DynamicResource HyperlinkButtonLinkGlyph}" -->
<!-- Foreground="{DynamicResource CheckBoxForeground}" -->
<!-- Height="{DynamicResource HyperlinkButtonLinkGlyphHeight}" -->
<!-- Name="LinkGlyph" -->
<!-- VerticalAlignment="Bottom" -->
<!-- Width="{DynamicResource HyperlinkButtonLinkGlyphWidth}" /> -->
</Grid>
<ContentPresenter
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Cursor="{TemplateBinding Cursor}"
Grid.Column="1"
IsVisible="{TemplateBinding Content,
Converter={x:Static ObjectConverters.IsNotNull}}"
RecognizesAccessKey="True"
VerticalAlignment="Center"
x:Name="ContentPresenter" />
</Grid>
</ControlTemplate>
</Setter>
</Style>
<!-- Unvisited Pointerover State --> <!-- Unvisited Pointerover State -->
<Style Selector="^:pointerover"> <Style Selector="^:pointerover">
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultPrimaryForeground}" /> <Setter Property="Foreground" Value="{DynamicResource ButtonDefaultPrimaryForeground}" />
@ -104,5 +65,101 @@
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" /> <Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
</Style> </Style>
</Style> </Style>
<Style Selector="^.WithIcon">
<Setter Property="Template">
<ControlTemplate TargetType="HyperlinkButton">
<Grid ColumnDefinitions="Auto,*" x:Name="RootGrid">
<Grid Grid.Column="0" VerticalAlignment="Center">
<Border
Background="{DynamicResource CheckBoxDefaultBackground}"
Height="{DynamicResource HyperlinkButtonIconHeight}"
Opacity="0"
UseLayoutRounding="False"
Width="{DynamicResource HyperlinkButtonIconWidth}"
x:Name="BackgroundRectangle" />
<PathIcon
Data="{DynamicResource HyperlinkButtonLinkGlyph}"
Foreground="{DynamicResource CheckBoxForeground}"
Height="{DynamicResource HyperlinkButtonLinkGlyphHeight}"
Name="LinkGlyph"
VerticalAlignment="Center"
Width="{DynamicResource HyperlinkButtonLinkGlyphWidth}" />
</Grid>
<ContentPresenter
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Cursor="{TemplateBinding Cursor}"
Grid.Column="1"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
IsVisible="{TemplateBinding Content,
Converter={x:Static ObjectConverters.IsNotNull}}"
Padding="8,0,0,0"
RecognizesAccessKey="True"
TextWrapping="Wrap"
VerticalAlignment="Center"
x:Name="ContentPresenter" />
</Grid>
</ControlTemplate>
</Setter>
<!-- Unvisited Pointerover State -->
<Style Selector="^:pointerover">
<Style Selector="^ /template/ PathIcon#LinkGlyph">
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultPrimaryForeground}" />
</Style>
<Style Selector="^ /template/ ContentPresenter#ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultPrimaryForeground}" />
</Style>
</Style>
<!-- Unvisited Pressed State -->
<Style Selector="^:pressed">
<Setter Property="RenderTransform" Value="scale(0.98)" />
</Style>
<!-- Unvisited Disabled state -->
<Style Selector="^:disabled">
<Style Selector="^ /template/ PathIcon#LinkGlyph">
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
</Style>
<Style Selector="^ /template/ ContentPresenter#ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
</Style>
</Style>
<Style Selector="^:visited">
<Style Selector="^ /template/ PathIcon#LinkGlyph">
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultTertiaryForeground}" />
</Style>
<Style Selector="^ /template/ ContentPresenter#ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultTertiaryForeground}" />
</Style>
<!-- Visited Pointerover State -->
<Style Selector="^:pointerover">
<Style Selector="^ /template/ PathIcon#LinkGlyph">
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultPrimaryForeground}" />
</Style>
<Style Selector="^ /template/ ContentPresenter#ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultPrimaryForeground}" />
</Style>
</Style>
<!-- Visited Pressed State -->
<Style Selector="^:pressed">
<Setter Property="RenderTransform" Value="scale(0.98)" />
</Style>
<!-- Visited Disabled State -->
<Style Selector="^:disabled">
<Style Selector="^ /template/ PathIcon#LinkGlyph">
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
</Style>
<Style Selector="^ /template/ ContentPresenter#ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
</Style>
</Style>
</Style>
</Style>
</ControlTheme> </ControlTheme>
</ResourceDictionary> </ResourceDictionary>

View File

@ -1,9 +1,9 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<x:Double x:Key="HyperlinkButtonFontSize">14</x:Double> <x:Double x:Key="HyperlinkButtonFontSize">14</x:Double>
<x:Double x:Key="HyperlinkButtonIconWidth">16</x:Double> <x:Double x:Key="HyperlinkButtonIconWidth">12</x:Double>
<x:Double x:Key="HyperlinkButtonIconHeight">16</x:Double> <x:Double x:Key="HyperlinkButtonIconHeight">12</x:Double>
<x:Double x:Key="HyperlinkButtonLinkGlyphWidth">16</x:Double> <x:Double x:Key="HyperlinkButtonLinkGlyphWidth">12</x:Double>
<x:Double x:Key="HyperlinkButtonLinkGlyphHeight">16</x:Double> <x:Double x:Key="HyperlinkButtonLinkGlyphHeight">12</x:Double>
<PathGeometry x:Key="HyperlinkButtonLinkGlyph">M 12.9393 2.9393 C 15.182 0.69666 18.818 0.696668 21.0606 2.93931 C 23.3033 5.18195 23.3033 8.81799 21.0606 11.0606 L 18.3925 13.7288 C 18.4631 13.3298 18.5 12.9192 18.5 12.5 C 18.5 11.5751 18.3206 10.6921 17.9947 9.88386 L 18.9393 8.93931 C 20.0104 7.86824 20.0104 6.13169 18.9393 5.06063 C 17.8682 3.98956 16.1317 3.98956 15.0606 5.06062 L 11.0606 9.06063 C 9.98956 10.1317 9.98956 11.8682 11.0606 12.9393 C 11.3265 13.2052 11.6335 13.4051 11.961 13.539 L 9.75848 15.7415 C 9.47 15.5439 9.19556 15.3169 8.9393 15.0606 C 6.69666 12.818 6.69666 9.18195 8.9393 6.93931 L 12.9393 2.9393 Z M 2.9393 12.9393 L 5.60751 10.2711 C 5.53685 10.6701 5.49999 11.0808 5.49999 11.5001 C 5.49999 12.4249 5.67935 13.3079 6.00519 14.1161 L 5.06062 15.0607 C 3.98956 16.1317 3.98956 17.8683 5.06063 18.9393 C 6.13169 20.0104 7.86824 20.0104 8.9393 18.9393 L 12.9393 14.9393 C 14.0104 13.8683 14.0104 12.1317 12.9393 11.0607 C 12.7664 10.8878 12.5762 10.7428 12.3743 10.6258 L 14.5302 8.46985 C 14.7141 8.61357 14.8914 8.77007 15.0606 8.93934 C 17.3033 11.182 17.3033 14.818 15.0606 17.0607 L 11.0606 21.0607 C 8.81798 23.3033 5.18194 23.3033 2.9393 21.0607 C 0.696665 18.818 0.696663 15.182 2.9393 12.9393 Z</PathGeometry> <PathGeometry x:Key="HyperlinkButtonLinkGlyph">M 12.9393 2.9393 C 15.182 0.69666 18.818 0.696668 21.0606 2.93931 C 23.3033 5.18195 23.3033 8.81799 21.0606 11.0606 L 18.3925 13.7288 C 18.4631 13.3298 18.5 12.9192 18.5 12.5 C 18.5 11.5751 18.3206 10.6921 17.9947 9.88386 L 18.9393 8.93931 C 20.0104 7.86824 20.0104 6.13169 18.9393 5.06063 C 17.8682 3.98956 16.1317 3.98956 15.0606 5.06062 L 11.0606 9.06063 C 9.98956 10.1317 9.98956 11.8682 11.0606 12.9393 C 11.3265 13.2052 11.6335 13.4051 11.961 13.539 L 9.75848 15.7415 C 9.47 15.5439 9.19556 15.3169 8.9393 15.0606 C 6.69666 12.818 6.69666 9.18195 8.9393 6.93931 L 12.9393 2.9393 Z M 2.9393 12.9393 L 5.60751 10.2711 C 5.53685 10.6701 5.49999 11.0808 5.49999 11.5001 C 5.49999 12.4249 5.67935 13.3079 6.00519 14.1161 L 5.06062 15.0607 C 3.98956 16.1317 3.98956 17.8683 5.06063 18.9393 C 6.13169 20.0104 7.86824 20.0104 8.9393 18.9393 L 12.9393 14.9393 C 14.0104 13.8683 14.0104 12.1317 12.9393 11.0607 C 12.7664 10.8878 12.5762 10.7428 12.3743 10.6258 L 14.5302 8.46985 C 14.7141 8.61357 14.8914 8.77007 15.0606 8.93934 C 17.3033 11.182 17.3033 14.818 15.0606 17.0607 L 11.0606 21.0607 C 8.81798 23.3033 5.18194 23.3033 2.9393 21.0607 C 0.696665 18.818 0.696663 15.182 2.9393 12.9393 Z</PathGeometry>
</ResourceDictionary> </ResourceDictionary>