我希望底部的文本框填满整个表单。这是我到目前为止,显然,非常困难。有什么想法吗?
<DockPanel LastChildFill="True">
<StackPanel Orientation="Vertical">
<Grid HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBox Name="Textbox1" Controls:TextBoxHelper.ClearTextButton="True"
Controls:TextBoxHelper.Watermark=".Zip file location"
IsReadOnly="False" Grid.Column="0" Grid.Row="0"/>
<Button Name="openbtn" Content="Open" Width="75" Click="openbtn_click" Grid.Column="1" Grid.Row="0"/>
<Button Name="startbtn" Content="Start" Width="75" Click="startbtn_click" Grid.Column="2" Grid.Row="0"/>
</Grid>
<TextBox x:Name="logs"/>
</StackPanel>
</DockPanel>
答案 0 :(得分:1)
您不需要堆叠面板,因为它的高度是其所包含项目的总高度(然后最后一项不能填充剩余的外层空间)。
所以我建议你使用网格来完成你想要的行为:
<Grid HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="20"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBox Name="Textbox1"
IsReadOnly="False" Grid.Column="0" Grid.Row="0"/>
<Button Name="openbtn" Content="Open" Width="75" Click="openbtn_click" Grid.Column="1" Grid.Row="0"/>
<Button Name="startbtn" Content="Start" Width="75" Click="startbtn_click" Grid.Column="2" Grid.Row="0"/>
<TextBox x:Name="logs" Grid.Row="1" Grid.ColumnSpan="3"/>
</Grid>
希望有所帮助