Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Align bottoms of text in controls
Message
From
10/01/2010 09:43:45
 
 
To
09/01/2010 22:28:11
General information
Forum:
ASP.NET
Category:
Windows Presentation Foundation (WPF)
Miscellaneous
Thread ID:
01442990
Message ID:
01443025
Views:
36
>The following snippet:
>
>
>    <Window x:Class="Window1"
>        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
>        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
>        <Grid>
>            <StackPanel Orientation="Horizontal"
>                        VerticalAlignment="Center"
>                        HorizontalAlignment="Center">            
>                <Label Content="Name:"/>
>                <Label Content="Itzhak Perlman" FontSize="44"/>
>            </StackPanel>
>        </Grid>
>    </Window>
>
>
>Produces the first label on top like in http://farm5.static.flickr.com/4034/4260633381_1a8a71c79b_o.png.
>
>Is there any way to align the bottoms?
>NOTE: I tried HorizontalAlignment, HorizontalContentAlignment, Margin, Padding.
<Label VerticalContentAlignment="Bottom"  Content="Name:"/>
should do what you want but I've a feeling it won't give you the effect you expect since the setting has to allow for descenders and you are using different font sizes. Using VerticalAlignment will give the same appearance (unless you set, say, the background color). Best bet is probably VerticalContentAlignment="Center". If you do want to align text baselines then I guess you should be able to do this by adjusting the bottom margin. Something like :
<Label VerticalContentAlignment="Bottom"  Content="Name:" Margin="0,0,0,8"/>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform