2012-06-16 64 views
2

是否有可能在wpf中的面板中浮動(與對齊重疊)的子項。 我有4個互相重疊的按鈕。他們需要對齊左側,右側,頂部和底部,並與父容器一起增長。請查看圖片以獲取更多信息。浮動面板(與對齊重疊)

enter image description here

回答

1

這個怎麼樣?

<Grid> 
    <Grid> 
     <Grid.RowDefinitions> 
      <RowDefinition Height="1*"/> 
      <RowDefinition Height="2*"/> 
      <RowDefinition Height="1*"/> 
     </Grid.RowDefinitions> 
     <Grid.ColumnDefinitions> 
      <ColumnDefinition/> 
      <ColumnDefinition/> 
     </Grid.ColumnDefinitions> 

     <Button Grid.Row="1" Grid.Column="0" Content="Left"/> 
     <Button Grid.Row="1" Grid.Column="1" Content="Right"/> 
    </Grid> 
    <Grid> 
     <Grid.RowDefinitions> 
      <RowDefinition/> 
      <RowDefinition /> 
     </Grid.RowDefinitions> 
     <Grid.ColumnDefinitions> 
      <ColumnDefinition Width="1*"/> 
      <ColumnDefinition Width="2*"/> 
      <ColumnDefinition Width="1*"/> 
     </Grid.ColumnDefinitions> 

     <Button Grid.Row="0" Grid.Column="1" Content="Top"/> 
     <Button Grid.Row="1" Grid.Column="1" Content="Bottom"/> 
    </Grid> 
</Grid> 

這導致

enter image description here