O'Reilly logo

Microsoft® Silverlight® Edition: Programming Windows® Phone 7 by Charles Petzold

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The StackPanel Stack

Here are the same four elements in a StackPanel, which is nested in the content grid:

Example 9-2. Silverlight Project: StackPanelWithFourElements File: MainPage.xaml (excerpt)

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
    <StackPanel Name="stackPanel"
                Orientation="Vertical">
        <TextBlock Text="TextBlock aligned at right bottom"
                   HorizontalAlignment="Right"
                   VerticalAlignment="Bottom" />

        <Image Source="Images/BuzzAldrinOnTheMoon.png" />

        <Ellipse Stroke="{StaticResource PhoneAccentBrush}"
                 StrokeThickness="12" />

        <TextBlock Text="TextBlock aligned at left top"
                   HorizontalAlignment="Left"
                   VerticalAlignment="Top" />
    </StackPanel>
</Grid>

By default, the StackPanel arranges its children in a stack from top to bottom. The ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required