网格分离器不能正常工作,它的移动方向相反

时间:2016-12-07 14:19:51

标签: c# wpf

这是我的示例代码。这有什么问题?当我移动网格分割器时,它正朝着相反的方向移动。

<Grid Grid.Row="2" Grid.Column="2">

    <Grid.RowDefinitions>
        <RowDefinition MinHeight="400" Height="*"/>
        <RowDefinition Height="5"/>
        <RowDefinition MinHeight="200" Height="Auto"/>
    </Grid.RowDefinitions>

    <ContentControl cal:RegionManager.RegionName="MainWorkAreaRegion" DockPanel.Dock="Right" FocusVisualStyle="{DynamicResource ControlFocusVisualStyle}"  />
    <!--<Separator Grid.Row="1" Height="2"  HorizontalAlignment="Stretch" Margin="-2,0" Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" Background="#7F7F7F"/>-->
    <GridSplitter Grid.Row="1" Height="2"   HorizontalAlignment="Stretch" VerticalAlignment="Top" Background="#7F7F7F"/>
    <!--<GridSplitter Grid.Column="0" Height="5"   Grid.RowSpan="1" HorizontalAlignment="Stretch" VerticalAlignment="Top"/>-->
    <ContentControl cal:RegionManager.RegionName="LoggedEventAreaRegion" DockPanel.Dock="Right" FocusVisualStyle="{DynamicResource ControlFocusVisualStyle}"  Grid.Row="2"/>

</Grid>

1 个答案:

答案 0 :(得分:0)

删除VerticalAlignment="Top"属性以恢复默认的GridSplitter行为。

<GridSplitter Grid.Row="1" Height="2" HorizontalAlignment="Stretch" Background="#7F7F7F"/>

或者,您可以更改ResizeDirectionResizeBehavior属性的值以实现所需的行为。