silverlight字符串格式限制字符数
我正在使用 SubString
方法来限制字符数。这可以在 XAML 中实现吗?如果是这样,如何设置格式字符串来限制 XAML 中的字符数,如 String.Format
例如:
我的大短信 ->我的大文本....
I am using the SubString
method to limit the character count. Is this possible to do in XAML? If so, how do you set the format string to limit the character count in XAML as in String.Format
For example:
My Big text Message -> My Big text....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 TextTrimming Silverlight 4 中
TextBlock
的 属性应该可以工作:这样做的好处是它将使用实际的文本测量而不是任意字符计数,因为显然并非所有字符都是宽度相同。
Using the TextTrimming property of
TextBlock
in Silverlight 4 should work:What's nice about this is that it will use actual text measurements instead of arbitrary character counts, since obviously not all characters are the same width.