views:

24

answers:

1

I'm creating a Silverlight 4 application and I want to have an image and some text below it centered.

My idea is to have a stackpanel for this purpose but it seems that it centers the control but not the text.

Any suggestions?

<StackPanel Height="182" HorizontalAlignment="Left" Margin="306,76,0,0" Name="stackPanel1" VerticalAlignment="Top" Width="200">
    <Image Height="100" Name="image1" Stretch="Fill" Width="100" HorizontalAlignment="Center"/>
    <dataInput:Label Content="Promedio" Height="20" Name="label4" Width="62" Foreground="Black" HorizontalAlignment="Center"/>
</StackPanel>

Thanks for the help

+1  A: 

take the Width property out of the Label, set HorizontalContentAlignment="Center" on the Stack Panel

Alex Lo
That worked, thanks a bunch!
Serg