[WPF] Layout WPF 2012. 3. 14. 15:19

레이아웃은 알다시피 화면 구성요소들의 배치이다. 레이아웃을 정의 하도록 패널이라는 것이 존재하는데 이것은 컨트롤러들을 담을 수 있는 그릇이라 생각하면 된다.

다음 예제는 레이아웃에 대해 확인 할 수 있는 샘플이다.

<Grid.RowDefinitions>
            <RowDefinition Height=" 33*"/>
            <RowDefinition Height=" 33*"/>
            <RowDefinition Height=" 34*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="33*"/>
            <ColumnDefinition Width="33*"/>
            <ColumnDefinition Width="34*"/>
        </Grid.ColumnDefinitions>
        <Rectangle Fill="Red" Grid.Row="0" Grid.Column="0"/>
        <Rectangle Fill="Orange" Grid.Row="0" Grid.Column="1"/>
        <Rectangle Fill="Yellow" Grid.Row="0" Grid.Column="2"/>
        <Rectangle Fill="Green" Grid.Row="1" Grid.Column="0"/>
        <Rectangle Fill="Blue" Grid.Row="1" Grid.Column="1"/>
        <Rectangle Fill="DarkBlue" Grid.Row="1" Grid.Column="2"/>
        <Rectangle Fill="Purple" Grid.Row="2" Grid.Column="0"/>
        <Rectangle Fill="White" Grid.Row="2" Grid.Column="1"/>
        <Rectangle Fill="Black" Grid.Row="2" Grid.Column="2"/>