MAUIverse MAUIverse

Displaying HTML in a .NET MAUI Label

If a field in your API response contains HTML, you don’t necessarily need a WebView to show it. The Label control can render HTML itself through two properties: Text, which holds the content, and TextType, which accepts Text (the default) or Html.

Leomaris uses a sample of two paragraphs that include underlined and strikethrough text. She sets it up in C# first, then in XAML, and finally with a CDATA section, which keeps larger HTML blocks readable in the markup.

There’s one caveat to remember. The Label only shows the HTML tags that the underlying platform supports, so check the result on each target you ship to. It’s a short article and a handy one when you’re formatting server-provided text.

View Source →

← Back to Community Feed

}