2012-09-21 2 views
1

나는 그리드 스플리터가있는 그리드가 포함 된 확장기가 있습니다.GridSplitter 내부 확장기 확장 높이

문서 개요 및 UI이

enter image description here

처럼 여기에 코드입니다. 우리는 그리드 스플리터를 사용하는 경우

<Grid x:Name="TopGrid" ShowGridLines="True" > 
<Grid.RowDefinitions> 
    <RowDefinition Height="Auto" MaxHeight="150"/> 
    <RowDefinition Height="200" /> 
</Grid.RowDefinitions> 
<Expander x:Name="CompanyDescriptionExpander" Grid.ColumnSpan="2" 
      VerticalAlignment="Top" IsExpanded="True" Background="Black" > 
    <Expander.Header> 
    <Grid Width="{Binding ElementName=CompanyDescriptionExpander, 
         Path=ActualWidth}" Background="Aquamarine"> 
    <TextBlock Grid.Column="0" Text="Expander Header" Foreground="Black" /> 
    </Grid> 
    </Expander.Header> 
    <Expander.Content> 
    <Grid x:Name="DescriptionGrid" MaxHeight="130" ShowGridLines="True"> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="*" MinHeight="25" MaxHeight="25"/> 
     <RowDefinition Height="Auto" MinHeight="25" MaxHeight="120"/> 
     <RowDefinition Height="4" MinHeight="10" MaxHeight="10"/> 
    </Grid.RowDefinitions> 
    <Grid.ColumnDefinitions> 
     <ColumnDefinition Width="*" /> 
     <ColumnDefinition Width="Auto" /> 
    </Grid.ColumnDefinitions> 
    <TextBox Grid.Column="0" Background="Orange" Grid.Row="0" Grid.RowSpan="2" 
       MinHeight="40" MaxHeight="120" x:Name="DescriptionText" 
       Text="TextBlock Content" HorizontalAlignment="Stretch" 
       VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" 
       VerticalContentAlignment="Top" 
       HorizontalScrollBarVisibility="Hidden" 
       VerticalScrollBarVisibility="Auto" /> 
    <Button x:Name="SaveIconButton" Grid.Column="1" Grid.Row="0" Width="20" 
      Height="20" VerticalAlignment="Top" /> 
    <Button x:Name="CancelIconButton" Grid.Column="1" Grid.Row="1" Width="20" 
      Height="20" VerticalAlignment="Top" /> 
    <GridSplitter ResizeBehavior="PreviousAndCurrent" ResizeDirection="Rows" 
        Grid.Row="2" Grid.ColumnSpan="2" 
        Height="10" MaxHeight="10" HorizontalAlignment="Stretch" 
        VerticalAlignment="Top" Background="Red" /> 
    </Grid> 
    </Expander.Content> 
</Expander> 
<Button Grid.Row="1" Grid.Column="0" Margin="0,5,0,0" Height="20" 
     VerticalAlignment="Top" Background="Green" /> 
</Grid> 

그것은

enter image description here

을 확장하지만 텍스트 상자가 최대 높이에 도달 gridsplitter 버튼 (녹색) 뒤에가는 후에도에 간다.

내 문제 시나리오는 내가 텍스트 상자가 최대 높이에 도달 할 때 중지해야 할 프로젝트

enter image description here

내 코드를 복사 복제 할 수 있습니다.

어떻게 수행하나요? 이 그리드는 그리드 자체의 최대 높이를 초과에서 DescriptionGrid에서

답변

2

는 95

행 × 3 열의 합한 최대 높이 (120)에서 두 번째 행을 변경 MaxHeight입니다.