<ResourceDictionary
    x:CompileBindings="True"
    xmlns="https://github.com/avaloniaui"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <ControlTheme TargetType="HyperlinkButton" x:Key="{x:Type HyperlinkButton}">
        <Setter Property="Padding" Value="0,0,0,0" />
        <Setter Property="HorizontalAlignment" Value="Left" />
        <Setter Property="VerticalAlignment" Value="Top" />
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="FontSize" Value="{DynamicResource HyperlinkButtonFontSize}" />
        <Setter Property="MinHeight" Value="32" />
        <Setter Property="Foreground" Value="{DynamicResource HyperlinkButtonForeground}" />
        <Setter Property="Background" Value="{DynamicResource HyperlinkButtonDefaultBackground}" />
        <Setter Property="Template">
            <ControlTemplate TargetType="HyperlinkButton">
                <Grid ColumnDefinitions="Auto,*" x:Name="RootGrid">
                    <Grid
                        Grid.Column="0"
                        IsVisible="False"
                        Margin="0,0,8,0"
                        VerticalAlignment="Center"
                        x:Name="IconGrid">
                        <Border
                            Background="{DynamicResource HyperlinkButtonDefaultBackground}"
                            Height="{DynamicResource HyperlinkButtonIconHeight}"
                            Opacity="0"
                            UseLayoutRounding="False"
                            Width="{DynamicResource HyperlinkButtonIconWidth}"
                            x:Name="BackgroundRectangle" />
                        <PathIcon
                            Data="{DynamicResource HyperlinkButtonLinkGlyph}"
                            Foreground="{DynamicResource HyperlinkButtonForeground}"
                            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}"
                        Padding="0,0,0,0"
                        RecognizesAccessKey="True"
                        VerticalAlignment="Center"
                        x:Name="ContentPresenter" />
                </Grid>
            </ControlTemplate>
        </Setter>

        <Style Selector="^:pointerover">
            <Style Selector="^ /template/ PathIcon#LinkGlyph">
                <Setter Property="Foreground" Value="{DynamicResource HyperlinkButtonOverForeground}" />
            </Style>
            <Style Selector="^ /template/ ContentPresenter#ContentPresenter">
                <Setter Property="Foreground" Value="{DynamicResource HyperlinkButtonOverForeground}" />
            </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 HyperlinkButtonDisabledForeground}" />
            </Style>
            <Style Selector="^ /template/ ContentPresenter#ContentPresenter">
                <Setter Property="Foreground" Value="{DynamicResource HyperlinkButtonDisabledForeground}" />
            </Style>
        </Style>

        <Style Selector="^:visited">
            <Style Selector="^ /template/ PathIcon#LinkGlyph">
                <Setter Property="Foreground" Value="{DynamicResource HyperlinkButtonVisitedForeground}" />
            </Style>
            <Style Selector="^ /template/ ContentPresenter#ContentPresenter">
                <Setter Property="Foreground" Value="{DynamicResource HyperlinkButtonVisitedForeground}" />
            </Style>

            <!--  Visited Pointerover State  -->
            <Style Selector="^:pointerover">
                <Style Selector="^ /template/ PathIcon#LinkGlyph">
                    <Setter Property="Foreground" Value="{DynamicResource HyperlinkButtonOverForeground}" />
                </Style>
                <Style Selector="^ /template/ ContentPresenter#ContentPresenter">
                    <Setter Property="Foreground" Value="{DynamicResource HyperlinkButtonOverForeground}" />
                </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 HyperlinkButtonDisabledForeground}" />
                </Style>
                <Style Selector="^ /template/ ContentPresenter#ContentPresenter">
                    <Setter Property="Foreground" Value="{DynamicResource HyperlinkButtonDisabledForeground}" />
                </Style>
            </Style>
        </Style>

        <Style Selector="^.WithIcon">
            <Style Selector="^ /template/ Grid#IconGrid">
                <Setter Property="IsVisible" Value="True" />
            </Style>
        </Style>
    </ControlTheme>
</ResourceDictionary>