Reputation: 117
How do you add superscript to a label in Xamarin Forms using Xaml. Specifically, I would like to add a TM superscript for trademark.
Upvotes: 3
Views: 2307
Reputation: 61
Set the Label
's TextType
property to Html
.
For example, to produce: x2 + y
In XAML:
<Label Text="x<sup><small>2</small></sup> + y" TextType="Html"/>
or
<Label TextType="Html">
<![CDATA[
x<sup><small>2</small></sup> + y
]]>
</Label>
In C#:
Label myLabel=new Label{TextType=TextType.Html,Text="x<sup><small>2</small></sup> + y"}
Note that the <small> tag is optional.
For more information, see the "Display HTML" section of the Label
documentation: Xamarin.Forms Label: Display HTML
Upvotes: 2
Reputation: 13090
As Chris mentioned in the comment you can use the unicode character ™
(™)
You should use the CustomeRenderer if you want to do anything complex
Upvotes: 5