如何获取TextBlock的实际高度? [英] How to get Actual height of the TextBlock when It is wrapped?

查看:70
本文介绍了如何获取TextBlock的实际高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我们正在使用TextBlock我们的CustomControl,并面临AutoSize行为的问题。因为当TextBlock的文本也以正常模式包装时,我们的大小相同。所以我们无法根据它来应用大小。任何人都可以帮忙吗?

解决方案

嗨Ravindran,


[2016年3月30日更新]欢迎来到开发通用Windows应用程序论坛!


请阅读粘贴帖子,尤其是
发布指南:主题行标签

Windows 10 SDK和工具的已知问题


你可以在Loaded事件处理程序中获取TextBlock的实际高度。你也可以打电话给

Measure

安排
到将其添加到可视树后获取实际高度。



最好的问候,

David


We are using TextBlock in our CustomControl, and facing problem with AutoSize behavior. Since we are getting same size when TextBlock’s text is wrapped also in normal mode. So we are not able to apply size based on it. Can anyone help on this?

解决方案

Hi Ravindran,

[Updated 3/30/2016]Welcome to the Developing Universal Windows apps forum!

Please read the sticky posts, especially the Guide to posting: subject line tags and Known Issues for Windows 10 SDK and Tools

You may get the actual height of TextBlock in the Loaded event handler. Also you could call Measure and Arrange to get the actual height after you add it to the visual tree.

Best Regards,
David


这篇关于如何获取TextBlock的实际高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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