WPF如何在底线排列具有不同字体大小的TextBlock [英] WPF How to arrange TextBlock with different Fontsize at bottomline
本文介绍了WPF如何在底线排列具有不同字体大小的TextBlock的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
今天我遇到了一个非常恼人的 wpf 问题.
today i hit a really annoing problem with wpf.
我只想在底部对齐 Textblock 控件(具有不同的字体大小).
i just want to align Textblock controls(with different fontsize) at the bottom line.
<StackPanel Grid.Row="0" Orientation="Horizontal">
<TextBlock Text="ABC" FontSize="12" VerticalAlignment="Bottom"/>
<TextBlock Text="QWERT" FontSize="24" VerticalAlignment="Bottom"/>
<TextBlock Text="XYZ" FontSize="18" VerticalAlignment="Bottom"/>
</StackPanel>
我想念什么?
推荐答案
找到了解决方法.我必须在我的 TextBlock 中使用 Run
found a workaround. i have to use Run inside my TextBlock
<StackPanel Grid.Row="0" Orientation="Horizontal">
<TextBlock VerticalAlignment="Bottom">
<Run FontSize="12">ABC</Run>
<Run FontSize="24">QWERT</Run>
<Run FontSize="18">XYZ</Run>
</TextBlock>
</StackPanel>
这篇关于WPF如何在底线排列具有不同字体大小的TextBlock的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文