Xamarin 表单标签新行 [英] Xamarin forms Label new line

查看:38
本文介绍了Xamarin 表单标签新行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 Xamarin 表单页面中有一个 Label,它从它的视图模型接收它的 Text,并且文本包含 特点.如何让 Label 自动将文本分成两行?

I have a Label in my Xamarin forms page, that receives it's Text from it's view model, and the text contains the character. How can I make the Label to automatically split the text into two different rows?

推荐答案

复制自 Xamarin 论坛中的一个主题

可能是您的代码:

<Label FontSize="Medium" TextColor="Gray" Text="{translation:TranslationResource MyExpertsView_NoExpertsText}"  IsVisible="{Binding IsNoExpertsFound}"></Label>

<小时>

由于您的文本是从资源文件中检索的,LabelText 属性将输入视为纯文本,并且不允许任何转义字符.


Since your text is retrieved from a resource file, the Text property of Label treats the input as plain text and will not allow any escape characters.

您可以考虑对 TranslationResource 中的字符串进行预处理(将所有 替换为换行符).

You may consider pre-processing the strings (replacing all to line feeds) from theTranslationResource.

这篇关于Xamarin 表单标签新行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆