我想要一個邏輯和簡單的方式來產生一個控制集來填補和其餘的停靠的佈局。我可以使用:WPF:StackPanel與FirstChildFill?
<DockPanel LastChildFill="True">
<Button Content="3" DockPanel.Dock="Bottom" />
<Button Content="2" DockPanel.Dock="Bottom" />
<Button Content="1" />
</DockPanel>
但它不是很直觀的使用。我也可以這樣做:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Button Content="1" Grid.Row="0" />
<Button Content="2" Grid.Row="1" />
<Button Content="3" Grid.Row="2" />
</Grid>
但它也很多xaml。我真正想要的是這樣的:
<StackPanel Fill="None|First|Last">
<Button Content="1" />
<Button Content="2" />
<Button Content="3" />
</StackPanel>
怎麼能實現這一目標,而不必扭轉項目與DockPanel中並沒有使用行和附加屬性的固定數量與網格?
謝謝!這會讓我開始... – 2011-02-28 15:30:44