Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Align bottoms of text in controls
Message
De
10/01/2010 09:43:45
 
 
À
09/01/2010 22:28:11
Information générale
Forum:
ASP.NET
Catégorie:
Windows Presentation Foundation (WPF)
Divers
Thread ID:
01442990
Message ID:
01443025
Vues:
35
>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"/>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform