【发布时间】:2017-08-20 08:31:43
【问题描述】:
我无法对齐两个大小不同且相邻的标签。我必须将变量显示为大尺寸,将单位显示为小。但由于字体基线的位置不同,文本不在同一行。看看我的 xaml:
<StackPanel VerticalAlignment="Bottom" Orientation="Horizontal">
<Label Content="5" FontSize="70" FontWeight="DemiBold" Foreground="White" Padding="0" Margin="0" BorderBrush="White" BorderThickness="1" />
<Label Content="s" FontSize="14" Foreground="White" Padding="0" Margin="0" BorderBrush="White" BorderThickness="1" VerticalAlignment="Bottom" />
</StackPanel>
我看到了这个问题的解决方案:我可以选择边距或填充,但这不是一个好的决定。此外,我无法删除较大文本的上部间隙。可能存在更优雅的方式来解决这个问题。请告诉我这个,如果有人知道或告诉我这是不可能的,我会选择边距或填充。我一直在寻找解决方案。这里最相似:WPF: Aligning the base line of a Label and its TextBox 但是我的元素有不同的大小,这种方式对我不利。
感谢您的帮助!
【问题讨论】: