[英]WPF Textblock text arrangement
我有一个标签和文本框,它们彼此水平对齐。
<TextBlock Width="400" Margin="10" Padding="10">
<Label Foreground="Yellow" FontSize="13" FontWeight="Bold" >Heading:</Label>
<TextBlock FontSize="13" TextWrapping="Wrap" FontWeight="Bold" >here is the main contetn and how about adding it to left on seco
here is the main content and how about adding it to left on seco
</TextBlock>
</TextBlock>
我假设您的意思是希望标题和文本从同一行开始并在标题下溢出。 您可以通过使用Run元素在已定义的TextBlock中显示文本来做到这一点。
<TextBlock Width="400" Margin="10" Padding="10" TextWrapping="WrapWithOverflow">
<Run Foreground="Yellow" FontSize="13" FontWeight="Bold" >Heading:</Run>
<Run FontSize="13" FontWeight="Bold" >here is the main contetn and how about adding it to left on seco
here is the main content and how about adding it to left on seco
</Run>
</TextBlock>
您将Stack Panel用作标题和Grid,并具有“水平和垂直对齐”属性,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.