我有一个三行网格,前两行之间有一个 GridSplitter。第三行包含一个按钮。当 GridSplitter 被拖到窗口的中心或下部时,一切都会调整大小。当 GridSplitter 被拖到窗口顶部时,第二行无法正确调整大小,第三行被截断。
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:clr="clr-namespace:System;assembly=mscorlib"
Width="300" MinHeight="300" >
<Grid ShowGridLines="True">
<Grid.RowDefinitions>
<RowDefinition MinHeight="130" />
<RowDefinition MinHeight="50" />
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Rectangle Grid.Row="0" Fill="Aquamarine"/>
<GridSplitter Grid.Row="0" VerticalAlignment="Bottom" HorizontalAlignment="Stretch" Height="5" />
<ScrollViewer Grid.Row="1" >
<Rectangle Height="500" Fill="Orange"/>
</ScrollViewer>
<Button Grid.Row="2" Content="Close" Width="70" HorizontalAlignment="Right" Margin="5" Click="Close_Click"/>
</Grid>
</Window>