Silverlight:文本修剪

发布于 2024-09-05 05:58:33 字数 287 浏览 8 评论 0原文

有没有办法确定 TextTrimming 是否被触发?

例如,在我的第一行中,文本没有被修剪,因为它只有 20 个字符,在我的第二行中,文本有 1500 个字符,并且它修剪了文本,有没有办法识别它,例如 IsTextTrimmed 属性?

<TextBlock TextWrapping="Wrap" Text="{Binding test}" TextTrimming="WordEllipsis" />

谢谢

Is there a way to identify if TextTrimming is triggered?

For example in my first row, text is not trimmed because its only 20 characters, in my second row text are 1500 characters and it trims the text, is there a way to identify it, like IsTextTrimmed property?

<TextBlock TextWrapping="Wrap" Text="{Binding test}" TextTrimming="WordEllipsis" />

Thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

热情消退 2024-09-12 05:58:33

根据关于 TextWrapping 属性 的 MSDN 文档,

您可以检测剪切的文本
以编程方式因为实际宽度
对于 TextBlock 总是报告
扩大文本的大小,即使
不适合布局容器。
如果您知道在哪里读取宽度
对于正在执行的布局容器
剪辑,你可以比较这些
两个值。

替代文字

According to the MSDN documentation on the TextWrapping property,

You can detect clipped text
programmatically because ActualWidth
for a TextBlock always reports the
expanded size of the text, even if it
does not fit in the layout container.
If you know where to read the Width
for the layout container that is doing
the clipping, you can compare these
two values.

alt text

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文