是否可以在 Xamarin.Forms 标签小部件中使用粗体和非粗体文本?标签内是否也可以有端线?
<Label Text="Abc <b>def</b>"/>
<Label Text="Abc \ndef"/>
最佳答案
最好的方法是像这样绑定(bind) FormattedText 样式:
<Label FormattedText="{Binding CustomFormattedText}" />
在模型中:
public FormattedString CustomFormattedText
{
get
{
return new FormattedString
{
Spans = {
new Span { Text = Sum, FontAttributes=FontAttributes.Italic, FontSize="10" },
new Span { Text = Info, FontSize="10" } }
};
}
set { }
}
关于c# - 标签中的装饰和扩展文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30610210/