Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to achieve underlined hyperlink on Windows Store apps?

From what I have read, there appears to be no functionality to achieve an underline for TextBlocks or HyperlinkButtons or the like in Windows RT, which appears ludicrous, but anyway, does anybody have an elegant approach to tackling this, specifically to create a link which runs a Click event or binding command?

As you can see out-of-the-box support doesn't appear to exist: http://social.msdn.microsoft.com/Forums/en-CA/winappswithcsharp/thread/cba0c363-60da-4e

like image 418
GONeale Avatar asked Nov 19 '12 04:11

GONeale


1 Answers

This is how I've solved this problem before.

<HyperlinkButton x:Name="ExamplesLink" Click="ExamplesLink_Click"
   Extensions:FrameworkElementExtensions.SystemCursor="Hand">
   <TextBlock>
      <Underline>
        <Run Text="Examples"/>
      </Underline>
   </TextBlock>
</HyperlinkButton>

If you have the WinRT XAML toolkit you can set your cursor with the extension like above as well.

like image 164
Soheil Avatar answered Oct 14 '22 15:10

Soheil