Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fluent2: Missing HyperlinkButtonStyle #10369

Open
robert-abeo opened this issue Jan 30, 2025 · 0 comments
Open

Fluent2: Missing HyperlinkButtonStyle #10369

robert-abeo opened this issue Jan 30, 2025 · 0 comments

Comments

@robert-abeo
Copy link

Description

We have the light/dark resources for HyperlinkButton already but they are unused. I realize there is no HyperlinkButton in WPF but we can do what is done with AccentButtonStyle in this case.

Reproduction Steps

See Fluent Theme

Expected behavior

It would be ideal to pull this style into the Fluent theme. It is based on AccentButtonStyle and uses the already existing HyperlinkButton* resources.

    <Style
        x:Key="HyperlinkButtonStyle"
        TargetType="{x:Type Button}">
        <Setter Property="Focusable" Value="False" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Background" Value="{DynamicResource HyperlinkButtonBackground}" />
        <Setter Property="Foreground" Value="{DynamicResource HyperlinkButtonForeground}" />
        <Setter Property="BorderBrush" Value="Transparent" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Padding" Value="{StaticResource ButtonPadding}" />
        <Setter Property="HorizontalAlignment" Value="Left" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="FontWeight" Value="Normal" />
        <Setter Property="m:ControlHelper.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate
                    TargetType="{x:Type Button}">
                    <Border
                        x:Name="ContentBorder"
                        Width="{TemplateBinding Width}"
                        Height="{TemplateBinding Height}"
                        MinWidth="{TemplateBinding MinWidth}"
                        MinHeight="{TemplateBinding MinHeight}"
                        Padding="{TemplateBinding Padding}"
                        HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                        VerticalAlignment="{TemplateBinding VerticalAlignment}"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        CornerRadius="{TemplateBinding m:ControlHelper.CornerRadius}">
                        <TextBlock
                            x:Name="ContentTextBlock"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            Foreground="{TemplateBinding Foreground}"
                            Text="{TemplateBinding Content}"
                            TextAlignment="Center"
                            TextDecorations="Underline" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource HyperlinkButtonBackgroundPointerOver}" />
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource HyperlinkButtonBackgroundPressed}" />
                            <Setter TargetName="ContentTextBlock" Property="Foreground" Value="{DynamicResource HyperlinkButtonForegroundPressed}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource HyperlinkButtonBackgroundDisabled}" />
                            <Setter TargetName="ContentTextBlock" Property="Foreground" Value="{DynamicResource HyperlinkButtonForegroundDisabled}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

Actual behavior

Nothing is shown -- or -- the default .ToString() is shown.

Regression?

No response

Known Workarounds

No response

Impact

No response

Configuration

No response

Other information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant