fipcurren88
fipcurren88

Reputation: 701

Add Underline at HyperlinkButton XAML - UAP Win10

I need your help.

I add a hyperlinkbutton and this have an underline above the text but, when I add one textblock with two Run's, the underline disappear.

If I remove the aplicated styles, the problem is the same. (TextDecorations/TextDecoration not work for me)

I don't know the problem :/

Somebody help me?

Code:

            <HyperlinkButton x:Name="HyperLinkManager" Margin="40,0,0,24" Style="{StaticResource StyleHyperlinkButton}" Template="{StaticResource HyperlinkButtonControlTemplate}">
                <HyperlinkButton.Content>
                        <TextBlock >
                            <Run Text="Example 0"/>
                            <Run Text="Example 1" FontWeight="SemiBold"/>
                        </TextBlock>
                </HyperlinkButton.Content>
            </HyperlinkButton>

Upvotes: 1

Views: 566

Answers (1)

Rob Caplan - MSFT
Rob Caplan - MSFT

Reputation: 21899

The HyperlinkButton only underlines raw text on its own. If you set the content to something more complex (like a Button or an Image or a TextBlock) then you're in charge of your own underlining.

You can add an <Underline> element to your TextBlock inlines:

<HyperlinkButton.Content>
    <TextBlock >
        <Underline>
            <Run Text="Example 0"/>
            <Run Text="Example 1" FontWeight="SemiBold"/>
        </Underline>
    </TextBlock>
</HyperlinkButton.Content>

Upvotes: 1

Related Questions