Silverlight

09.SilverLight3 - Layout - StackPanel

Godffs 2009. 11. 24. 15:38
반응형
StackPanel
- UI 요소들을 수직, 수평으로 순서대로 나열하는 간단한 레이아웃 컨트롤로 배치가능

StackPanel의 Orientation 속성
- 기본값 : Vertical(수직)으로 Horizontal(수평)으로 변경 하능

MainPage.xaml

[그림 9-1]


<!--21 ( DesignHeight ) -->

<Grid x:Name="ctlLayout" Background="Red" Width="400" Height="300" ShowGridLines="True">

        <Grid.RowDefinitions>

            <RowDefinition></RowDefinition>

            <RowDefinition></RowDefinition>

        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>

            <ColumnDefinition></ColumnDefinition>

        </Grid.ColumnDefinitions>

       

        <StackPanel Background="Red">

            <Button Content="One" HorizontalAlignment="Left" Width="100"></Button>

            <Button Content="Two" HorizontalAlignment="Center" Width="100"></Button>

            <Button Content="Three" VerticalAlignment="Bottom"

                    HorizontalAlignment="Right"></Button>

        </StackPanel>

       

        <StackPanel Background="Yellow" Orientation="Horizontal" Grid.Row="1">

            <Button Content="Four" VerticalAlignment="Top" Width="100" Height="100">

            </Button>

            <Button Content="Five" HorizontalAlignment="Center"

                    VerticalAlignment="Stretch"></Button>

            <Button Content="Six" VerticalAlignment="Bottom" Width="100"></Button>

        </StackPanel>

</Grid>



반응형