wpf中GridSplitter控件,我界面中有两个datagrid中间有一个分割线,目前设置了,两个datagrid的最小高度,保证分割线在移动的时候,会卡在上下边缘有一段距离的位置。有两个按钮一个向上,一个向下想实现的功能是,点击向上,分割线自动移动到上边边缘位置,点击向下,分割线自动移动到下边边缘位置
<Grid.RowDefinitions>
</Grid.RowDefinitions>
</Grid>
这个是想要的向上效果,向下就是在下面
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="*" MinHeight="30"/>
<RowDefinition Height="5"/>
<RowDefinition Height="*" MinHeight="30"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<Button Content="向上"/>
<Button Content="向下" Margin="20,0,0,0"/>
</StackPanel>
<Grid Grid.Row="1">
<DataGrid/>
</Grid>
<GridSplitter x:Name="DoctorGridSplitter" Grid.Row="2" Height="5" HorizontalAlignment="Stretch" ShowsPreview="True" />
<Grid Grid.Row="3">
<DataGrid/>
</Grid>
</Grid>