I am using the WinUI technology.
I would like to display a HyperlinkButton
in my XAML.
The problem is that the HyperlinkButton
is not displayed underlined.
But according to this documentation this should be the case / the default behavior: MSDN - HyperlinkButton Class
Here is what I have:
<HyperlinkButton Content="Example" Click="HyperlinkButton_Click" />
Neither I have any style that would affect how the button is displayed nor did I change a template.
What am I missing? Thank you.
UPDATE
The problem exists in version 1.0.1 (march 2022) of Windows App SDK as well as in version 1.0.0 (november 2021), see windows-app-sdk/downloads
CodePudding user response:
The template of the HyperlinkButton
has changed in later versions of the Windows App SDK (1.0.0 ) but apparently the documentation hasn't been updated.
You should still be able to use a Hyperlink
element to get an underlined link though:
<TextBlock>
<Hyperlink Click="Hyperlink_Click">Example</Hyperlink>
</TextBlock>
CodePudding user response:
HyperlinkButton missing underlined text is almost confirmed a bug.
As a workaround to add underline on the button text string, you can try the following way to display something with TextDecorations
property as "Underline".
<HyperlinkButton Click="HyperlinkButton_Click">
<TextBlock Text="www.microsoft.com" TextDecorations="Underline" />
</HyperlinkButton>