wpf 如何在 CheckBox 中启用文本换行

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21368692/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 10:37:04  来源:igfitidea点击:

How to enable text wrapping in CheckBox

xmlwpfcheckboxword-wrapstackpanel

提问by sangeek

How I can wrap text in CheckBox? The text is a bit longer than width of page, but I cannot shorten it. CheckBox doesnt have TextWrapping attribute. ;(
Also I tried to set Width="460", Width="*", but I didnt succeed.

如何在 CheckBox 中包装文本?文本比页面宽度稍长,但我无法缩短它。CheckBox 没有 TextWrapping 属性。;(
我也尝试设置 Width="460", Width="*",但没有成功。

<StackPanel>
    <CheckBox Content="Lorem ipsum dolor sit amet, consectetur adipisicing elit." />
</StackPanel>

回答by d.lavysh

<CheckBox>
    <TextBlock Text="Test Text" TextWrapping="Wrap"/>
</CheckBox>