2011-04-13 4 views
9

내가GridSplitter 제대로 분할되지

<Grid>   
    <Grid.RowDefinitions> 
     <RowDefinition Height="Auto" /> 
     <RowDefinition Height="Auto" /> 
     <RowDefinition Height="*" /> 
     <RowDefinition Height="Auto" /> 
     <RowDefinition Height="Auto" /> 
     <RowDefinition Height="*" /> 
    </Grid.RowDefinitions> 

내 GridSplitter가 3 행 (4 행)에있는 다음 그리드를 가지고, 다음과 같이 정의 :

<GridSplitter Grid.Row="3" 
       ResizeDirection="Rows" 
       Style="{StaticResource HorizontalGridSplitter}" 
       IsTabStop="False" /> 
<Style x:Key="HorizontalGridSplitter" 
     TargetType="{x:Type GridSplitter}"> 
    <Setter Property="Height" 
      Value="4" /> 
    <Setter Property="HorizontalAlignment" 
      Value="Stretch" /> 
    <Setter Property="VerticalAlignment" 
      Value="Stretch" /> 
    <Setter Property="Margin" 
      Value="0" /> 
</Style> 

분할하기 위해 나는 분할을 끌 때 행 2/4, 정말 행을 분할하지 않습니다, 그리드 높이가 커지다 것 같습니다. 아래 볼 수 있듯이 GridSplitter

+0

나는 비슷한 문제가 있었지만 불행히도 내가 어떻게 해결했는지 기억하지 못합니다 ... –

답변

24

는 세 가지 다른 크기 조정 동작이 있습니다

Resize Behaviours

GridSplitter 다시 크기를 선택한 ResizeBehaviour에 따라과에 사용할 수있는 공간에 따라, 지정된 두 개의 열/행 그 (것)들 경우에 당신은 이전에 행을위한 * 고도 및 후에 행을위한 자동 고도를 지정했다, 그것은 행의 크기를 재조정 할 수 있고, 그 후에 행은 항상 Auto을 남길 것이다 :

enter image description here

당신이 Width="*"에 후 이전 행과 행을 설정하고 다음 코드를 참조하십시오 ResizeBehavior="PreviousAndNext"에 다시 크기의 동작을 설정해야이 문제를 해결하려면 :

<Grid> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="Auto" /> 
     <RowDefinition Height="Auto" /> 
     <RowDefinition Height="*" /> 
     <RowDefinition Height="Auto" /> 
     <RowDefinition Height="*" /> 
     <RowDefinition Height="Auto" /> 
    </Grid.RowDefinitions> 
    <GridSplitter Grid.Row="3" ResizeDirection="Rows" 
        Style="{StaticResource HorizontalGridSplitter}"      
        IsTabStop="False" HorizontalAlignment="Stretch" 
        ResizeBehavior="PreviousAndNext" /> 
</Grid> 
또한

그것은 더 나은이를 설정을 다른 모든 행의 높이를 Auto 또는 이상한 행동을 피하기 위해 고정 값으로 설정하십시오.