2013-02-06 16 views
0

這裏是我的代碼(這是不BTW工作):WPF 3行需要電網來填補窗口,只有中間一排拉伸

<DockPanel MinWidth="776" Margin="13" LastChildFill="True" Height="522" VerticalAlignment="Top"> 
    <Grid DockPanel.Dock="Top" MinWidth="200"> 
     <Grid.RowDefinitions> 
      <RowDefinition Height="70" /> 
      <RowDefinition Height="*"/> 
      <RowDefinition Height="150" /> 
     </Grid.RowDefinitions> 
     <Grid.ColumnDefinitions> 
      <ColumnDefinition /> 
     </Grid.ColumnDefinitions> 
</Grid> 
... 
</DockPanel> 

當我垂直尺寸控制一切只是堅持到頂部(我想要的,除了中間拉伸)。

在此先感謝!

回答

0

如果你能堅持只停靠面板,你做的東西像下面這樣:

<DockPanel LastChildFill="true"> 
    <DockPanel DockPanel.Dock="Top" Height="70" /> 
    <DockPanel DockPanel.Dock="Bottom" Height="150" /> 
    <DockPanel DockPanel.Dock="Top"><!-- Expandable content here--></DockPanel> 
</DockPanel> 
0

你將不得不從碼頭面板LastChildFill="True", Height="522" VerticalAlignment="Top"從上漿停止網格中刪除一些值。

試試這個:

<DockPanel MinWidth="776" > 
     <Grid DockPanel.Dock="Top" MinWidth="200"> 
      <Grid.RowDefinitions> 
       <RowDefinition Height="70" /> 
       <RowDefinition Height="*"/> 
       <RowDefinition Height="150" /> 
      </Grid.RowDefinitions> 
      <Grid.ColumnDefinitions> 
       <ColumnDefinition /> 
      </Grid.ColumnDefinitions> 

      <Rectangle Fill="Blue" Grid.Row="0" /> 
      <Rectangle Fill="Green" Grid.Row="1" /> 
      <Rectangle Fill="Red" Grid.Row="2" /> 
     </Grid> 
    </DockPanel>