WPF How to arrange TextBlock with different Fontsize at bottomline
Asked Answered
Z

1

7

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?

Zulemazullo answered 5/7, 2012 at 8:48 Comment(2)
This Worked fine with me . I think there might be problem because of your Grid Row HeightTrost
nope, same result no matter if Grid Row Height is auto or *Zulemazullo
Z
21

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>
Zulemazullo answered 5/7, 2012 at 8:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.