본문 바로가기

.NET/WPF

WPF 기초 <Grid.RowDefinitions> <RowDefinition> <Grid.ColumnDefinitions> <ColumnDefinition>

반응형


 전체적으로 HTML과 비슷하다




<Page
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Title="Programming .Net 3.5 | Understanding Grids">
  <Grid>  
    <Grid.RowDefinitions>
      <RowDefinition></RowDefinition>
      <RowDefinition></RowDefinition>
      <RowDefinition></RowDefinition>
      <RowDefinition></RowDefinition>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
      <ColumnDefinition></ColumnDefinition>
      <ColumnDefinition></ColumnDefinition>
      <ColumnDefinition></ColumnDefinition>
      <ColumnDefinition></ColumnDefinition>
    </Grid.ColumnDefinitions>
    
    <TextBlock TextBlock.FontSize="36" TextBlock.Foreground="White" Background="Blue" Grid.Column="2" Grid.Row="0" Grid.RowSpan="2">1</TextBlock>
    <TextBlock TextBlock.FontSize="36" Background="Gold" Grid.Column="1" Grid.Row="0">2</TextBlock>
    <TextBlock TextBlock.FontSize="36" TextBlock.Foreground="White" Background="Crimson" Grid.Column="2" Grid.Row="3">3</TextBlock>
    <TextBlock TextBlock.FontSize="36" Background="White" Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2">4</TextBlock>
    <TextBlock TextBlock.FontSize="36" TextBlock.Foreground="White" Background="Purple" Grid.Column="0" Grid.Row="2">5</TextBlock>
    <TextBlock TextBlock.FontSize="36" TextBlock.Foreground="White" Background="Green" Grid.Column="1" Grid.Row="3">6</TextBlock>
    <TextBlock TextBlock.FontSize="36" TextBlock.Foreground="White" Background="Black" Grid.Column="2" Grid.Row="2">7</TextBlock>
    
  </Grid>
</Page>



- 출처  Programming .Net 3.5 by Jesse Liberty and Alex Horovitz. (소수 수정)