Programming/C#

[WPF] Grid 칸 합치기

비만오리 2018. 6. 12. 12:29


1. Reference


https://stackoverflow.com/questions/23789647/merge-grid-columns



2. Source


일단 Grid의 칸을 합치는 방법은 없다.


단, 그리드 내의 컨텐츠를 그리드 여러 칸을 쓰도록 하는 방법을 통해 합쳐진 것처럼 보이게 한다.


<Grid>

    <Grid.RowDefinitions>

        <RowDefinition Height="*" />

        <RowDefinition Height="2*" />

        <RowDefinition Height="*" />

    </Grid.RowDefinitions>

    <Grid.ColumnDefinitions>

        <ColumnDefinition Width="*" />

        <ColumnDefinition Width="3*" />

    </Grid.ColumnDefinitions>

</Grid>

The 5 cells would be like:


Top-left: Grid.Column="0", Grid.Row="0"

Top-right: Grid.Column="1", Grid.Row="0"

Center: Grid.Column="0", Grid.Row="1", Grid.ColumnSpan="2"

Bottom-left: Grid.Column="0", Grid.Row="2"

Bottom-right: Grid.Column="1", Grid.Row="2"

반응형