How to Change Only Underline Color of Hyperlink in TextBlock in UWP C#

Bel 46 Reputation points
2022-03-09T12:16:55+00:00

I don't want to change text color of hyperlink but just an underline color.... How to achieved this technics like picture sample below?
181396-screenshot-2022-03-09-201331.png

Or the text background color can be applied not include the text color..

Universal Windows Platform (UWP)
{count} votes

Accepted answer
  1. Nico Zhu (Shanghai Wicresoft Co,.Ltd.) 12,856 Reputation points
    2022-03-10T06:58:58.69+00:00

    Hello,
    Welcome to Microsoft Q&A!

    How to Change Only Underline Color of Hyperlink in TextBlock in UWP C#

    I have to say, you can't edit the Hyperlink color without changing text color. Hyperlink only contains Foreground property that cause text color change at same time.

    Can we create custom textblock and inlines in .NET Maui Graphics Or WIN2D with the pure customizable hyperlink and also clickable... ?

    Sure, you could use Win2D to draw text manually with under line, but it will be complicated, for more detail please refer Win2d document.

    Thank you.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful