0

每当我们移动红色 gridsplitter 时,它都不会改变绿色列的大小。

    <Window x:Class="WpfApplication1.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525">
    <Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Name="c1"  ></ColumnDefinition>
        <ColumnDefinition Name="c2"  Width="auto" ></ColumnDefinition>
        <ColumnDefinition Name="c3"  Width="200"  ></ColumnDefinition>
        <ColumnDefinition Name="c4" Width="auto" ></ColumnDefinition>
        <ColumnDefinition Name="c5"    Width="200" ></ColumnDefinition>

    </Grid.ColumnDefinitions>
    <Border Name="t1" Grid.Column="0" Background="Transparent" ></Border>
    <Border Name="t2" Grid.Column="2" Background="CadetBlue" ></Border>
    <Border Name="t3" Grid.Column="4" Background="Green" ></Border>
    <GridSplitter Name="gd1" Grid.Column="1" HorizontalAlignment="Stretch"  VerticalAlignment="Stretch" Width="3" ></GridSplitter>
    <GridSplitter Name="gd2" Background="red" Grid.Column="3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="3"></GridSplitter>
    </Grid>

    </Window>
4

1 回答 1

1

我认为这就是你想要的:

<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="auto"/>
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="auto"/>
        <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>

    <Border Grid.Column="0" Background="Transparent"/>
    <Border Grid.Column="2" Background="CadetBlue"/>
    <Border Grid.Column="4" Background="Green"/>

    <GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="3"/>

    <GridSplitter Grid.Column="3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="3" Background="red"/>        
</Grid>
于 2012-05-17T11:30:01.557 回答