Search code examples
wpfxamltextblock

WPF How to arrange TextBlock with different Fontsize at bottomline


today i hit a really annoing problem with wpf.

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>

enter image description here

what do i miss?


Solution

  • 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>