wpf中GridSplitter控件,我界面中有两个datagrid中间有一个分割线,目前设置了,两个datagrid的最小高度,保证分割线在移动的时候,会卡在上下边缘有一段距离的位置。有两个按钮一个向上,一个向下想实现的功能是,点击向上,分割线自动移动到上边边缘位置,点击向下,分割线自动移动到下边边缘位置
<Window x:Class="WpfApp3.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp3"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<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>
</Window>
我想点击向上按钮,和向下按钮,实现分割条自动到对应上方或者下方边缘位置