0

我有以下布局:

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="*" />
        <RowDefinition Height="4" />
        <RowDefinition Height="20" MinHeight="20" MaxHeight="20" />
        <RowDefinition Height="auto" />
    </Grid.RowDefinitions>
    <TextBox Grid.Row="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
    <GridSplitter Grid.Row="1" ResizeBehavior="PreviousAndNext" ResizeDirection="Rows" Background="Red" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
    <DockPanel Grid.Row="2" x:Name="toolbox" Background="Chocolate" />
    <TextBox Grid.Row="3" Height="50" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
</Grid>

如何使网格拆分器调整第 0 行和第 3 行之间的大小?

4

3 回答 3

0

试试这个:

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="*" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    <TextBox Grid.Row="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Background="SkyBlue" />
    <GridSplitter Grid.Row="1" Height="4" ResizeBehavior="PreviousAndNext" ResizeDirection="Rows" Background="Red" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
    <Grid Grid.Row="2">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <DockPanel Grid.Row="0" Height="20" x:Name="toolbox" Background="Chocolate" />
        <TextBox Grid.Row="1" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Background="Green" />
    </Grid>
</Grid>
于 2012-07-27T08:12:26.703 回答
0

这个怎么样

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    <TextBox Grid.Row="0" Background="Blue"
             VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
    <GridSplitter Grid.Row="1" Height="4" Background="Red"
                  ResizeBehavior="PreviousAndNext" ResizeDirection="Rows"
                  VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
    <DockPanel Grid.Row="2" Height="20" x:Name="toolbox" Background="Chocolate" />
    <TextBox Grid.Row="3" Background="Blue"
             VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
</Grid>
于 2012-07-27T08:18:14.330 回答
0

在网格中有一个网格。

        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <TextBox Grid.Row="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
            <GridSplitter Grid.Row="1" Height="4" ResizeBehavior="PreviousAndNext" ResizeDirection="Rows" Background="Red" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
            <Grid Grid.Row="2">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <DockPanel Grid.Row="0" Height="20"/>
                <TextBox Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
            </Grid>
        </Grid>
于 2012-07-27T19:23:05.937 回答