如何解决如何将Xamarin表单标签TextType设置为HTML?
我正在尝试将Xamarin表单标签的TextType属性设置为HTML。当我按如下所示设置此属性时,在运行时会收到错误消息,
“无法解析来自typeref的令牌0100011b的类型(程序集中的预期类'Xamarin.Forms.TextType'...”
我也无法将TextType设置为Text。我犯了同样的错误。如何将标签的TextType设置为HTML?
代码:
var lbl = new Label();
lbl.TextType = TextType.Html;
版本信息: Xamarin Forms 4.3.0
解决方法
您可以尝试
C#:
Label label = new Label{
Text = "This is <strong style=\"color:red\">HTML</strong> text.",TextType = TextType.Html};
XAML:
<Label Text="This is <strong style="color:red">HTML</strong> text."
TextType="Html" />
或
<Label TextType="Html">
<Label.Text>
<h1>Hello World!</h1><br/>SecondLine
</Label.Text>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。