c# - Decorated & Extended Text In a Label -


is possible have bold , non-bold text within xamarin.forms label widget? possible have endlines inside label aswell?

<label text="abc <b>def</b>"/> <label text="abc \ndef"/> 

have @ formattedstring in the documentation.

you create formattedstring object consists of multiple span objects, can have own font, weight, color, etc.

example:

var labelformatted = new label (); var fs = new formattedstring (); fs.spans.add (new span { text="red, ", foregroundcolor = color.red, fontsize = 20, fontattributes = fontattributes.italic) }); fs.spans.add (new span { text=" blue, ", foregroundcolor = color.blue, fontsize = 32) }); fs.spans.add (new span { text=" , green!", foregroundcolor = color.green, fontsize = 12) }); labelformatted.formattedtext = fs; 

in regard new line, \n should work. workaround this:

<label> <label.text> magical unicorn text </label.text> </label> 

Comments