Is it possible use HTML tags in resx file and use it as text of label?
I tried to use Some text
but not working. The tags are print
With Xamarin.Forms v4.3 and above your label can directly host HTML tags and work something like for instance
When you check the Microsoft documents you will see:
Label label = new Label
{
Text = "This is <strong style=\"color:red\">HTML</strong> text.",
TextType = TextType.Html
};
In the example above, the double-quote characters in the HTML have to be escaped using the \ symbol.
In XAML, HTML strings can become unreadable due to additionally escaping the < and > symbols:
<Label Text="This is <strong style="color:red">HTML</strong> text."
TextType="Html" />
Alternatively, for greater readability, the HTML can be inlined in a CDATA section
<Label TextType="Html">
<![CDATA[
This is <strong style="color:red">HTML</strong> text.
]]>
</Label>
In this example, the Label.Text property is set to the HTML string that's inlined in the CDATA section. This works because the Text property is the ContentProperty for the Label class.
The following screenshots show a Label displaying HTML:
Also just tested with Resx and that works too!