每当我们移动红色网格探测器时,它都不会改变绿柱的大小。
<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>
答案 0 :(得分: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>