Removing underline from hyperlink in Windows Store app Removing underline from hyperlink in Windows Store app windows windows

Removing underline from hyperlink in Windows Store app


I would write a comment, but my reputation is not enough to do that.

I tried the same code on a blank both win 8.1 and win phone 8.1 project. However, the hyperlink is displayed with color by default, not with an underline as opposed to your project. My code is like below

    <TextBlock Width="400" TextWrapping="Wrap">        <Span FontSize="20">            This is an example of how Hyperlink can be used in a paragraph of text. It might be helpful for you look to            <Hyperlink NavigateUri="http://www.bing.com" Foreground="#FF0007FF">bing</Hyperlink>             for more answers in the future.        </Span>    </TextBlock>

Could you try the Foreground property? Maybe it helps you.


In the final version of Windows 8.1 the Hyperlink-element doesn't have an underline. Maybe the confusion was caused by the focus border around the hyperlink? So the XAML:

    <TextBlock Width="400" TextWrapping="Wrap" VerticalAlignment="Center">        <Span FontSize="20">            This is an example of how Hyperlink can be used in a paragraph of text. It might be helpful for you look to            <Hyperlink NavigateUri="http://www.bing.com">bing</Hyperlink>             for more answers in the future.        </Span>    </TextBlock>

Shows as:

No underlining

One thing that can trick the viewer is that if the page doesn't have any other focusable items, the Hyperlink gets the focus and a border is drawn around it. This may look like it has underline:

Hyperlink focus

If you want to get rid of that, add Button with Opacity 0 to the top of the page.

If you want to style the Hyperlink, you can overwrite it using the following keys:

        <SolidColorBrush x:Key="HyperlinkDisabledThemeBrush" Color="#66000000" />        <SolidColorBrush x:Key="HyperlinkForegroundThemeBrush" Color="#FF4F1ACB" />        <SolidColorBrush x:Key="HyperlinkPointerOverForegroundThemeBrush" Color="#CC4F1ACB" />        <SolidColorBrush x:Key="HyperlinkPressedForegroundThemeBrush" Color="#994F1ACB" />

So if you have the following App.xaml.cs:

<Application.Resources>    <ResourceDictionary>        <SolidColorBrush x:Key="HyperlinkForegroundThemeBrush" Color="Green" />    </ResourceDictionary></Application.Resources>

You will get a green Hyperlink:

Green hyperlink

If you want the link to have underline, you can use the Underline-element. The XAML:

    <TextBlock Width="400" TextWrapping="Wrap" VerticalAlignment="Center">        <Span FontSize="20">            This is an example of how Hyperlink can be used in a paragraph of text. It might be helpful for you look to            <Hyperlink NavigateUri="http://www.bing.com"><Underline>bing</Underline></Hyperlink>             for more answers in the future.        </Span>    </TextBlock>

And the result:

Hyperlink underline


In my app I'm using

<Hyperlink TextDecorations="None" ...></Hyperlink>

to get rid of the underline.