WPFSilverlight XAML拉伸文本大小以适应容器?

WPFSilverlight XAML拉伸文本大小以适应容器?,第1张

概述我刚刚开始玩WPF。 是否可能有一个Label或TextBlock大小的文本的大小本身填充它的父容器? 谢谢, 标记 您可以使用ViewBox来可视化缩放某物,以适应其容器。其他解决方案在这里工作,但他们只是拉伸控制,而不是其内容。 ViewBox将拉伸两者。 <!-- Big grid, will stretch its children to fill itself --><Grid Wid 我刚刚开始玩WPF。

是否可能有一个Label或TextBlock大小的文本的大小本身填充它的父容器?

谢谢,
标记

解决方法 您可以使用VIEwBox来可视化缩放某物,以适应其容器。其他解决方案在这里工作,但他们只是拉伸控制,而不是其内容。 VIEwBox将拉伸两者。

<!-- Big grID,will stretch its children to fill itself --><GrID WIDth="1000" Height="1000"> <!-- The button is @R_334_4041@,but its text remains teeny tiny --> <button>  <!-- The vIEwBox will stretch its content   to fit the final size of the button -->  <VIEwBox      margin="4"      VerticalAlignment="Stretch"      Height="auto">      <!-- The textblock and its contents are       @R_334_4041@ to fill its parent -->      <TextBlock          Text="bartenders" />  </VIEwBox> </button></GrID>
总结

以上是内存溢出为你收集整理的WPF/Silverlight XAML拉伸文本大小以适应容器?全部内容,希望文章能够帮你解决WPF/Silverlight XAML拉伸文本大小以适应容器?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1008324.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存