2016-03-15 73 views

回答

2

您可以使用此方法,如您在提及的docs中指出的那樣。正如你的img它在垂直中的最後一個元素被描述,所以這種佈局將是: enter image description here

<Grid> 
     <Grid.RowDefinitions> 
      <RowDefinition 
       Height="24" /> 
      <RowDefinition 
      Height="20" /> 
    </Grid.RowDefinitions> 

    <Grid.ColumnDefinitions> 
     <ColumnDefinition 
      Width="44" /> 
     <ColumnDefinition 
      Width="*" /> 
     <ColumnDefinition 
      Width="10" /> 
    </Grid.ColumnDefinitions> 

    <Rectangle 
     Fill="Red" 
     Grid.RowSpan="2" 
     Grid.Column="0"/> 

    <Rectangle 
     Fill="Green" 
     Grid.Row="0" 
     Grid.Column="1" /> 

    <Rectangle 
     Fill="Yellow" 
     Grid.Row="1" 
     Grid.Column="1" /> 

    <Grid 
     Grid.RowSpan="2" 
     Grid.Column="2"> 

     <Grid.RowDefinitions> 
      <RowDefinition 
       Height="*" /> 
      <RowDefinition 
       Height="*" /> 
      <RowDefinition 
       Height="*" /> 
     </Grid.RowDefinitions> 

     <Rectangle 
      Fill="Gray" 
      Grid.Row="1"/> 

    </Grid> 

</Grid> 

爲了簡單和清楚我是用Rectangle

+0

THX,它適合我的完美需求 –

0

填充的空間可以用

width="*" 

進行,並在佈局小的複雜性可以與網格嵌套系統來處理。 這是開始,而不是您佈局的完整解決方案。

<Grid> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="44"/> 
    </Grid.RowDefinitions> 
    <Grid.ColumnDefinitions> 
     <ColumnDefinition Width="44"/> 
     <ColumnDefinition Width="*" /> 
     <ColumnDefinition Width="10"/> 
    </Grid.ColumnDefinitions> 

    <Grid Grid.Row="0" Grid.Column="1"> 
     <Grid.RowDefinitions> 
      <RowDefinition Height="24"/> 
      <RowDefinition Height="20"/> 
     </Grid.RowDefinitions> 
    </Grid> 
</Grid>