C#/WPF Grid和GridSplitter布局问题。
见图片,Grid共6列,从左到右每列主要需求0-可变宽度1-固定宽度202-GridSplitter3-固定宽度204-可变宽度5-固定宽度40要实现的是拖动GridSp...
见图片,Grid共6列,从左到右每列主要需求
0-可变宽度
1-固定宽度20
2-GridSplitter
3-固定宽度20
4-可变宽度
5-固定宽度40
要实现的是拖动GridSplitter可以实现让0或者4缩小至接近0或者最大。其他的固定列不变。
<Grid ShowGridLines="True">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="20" />
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="20"/>
<ColumnDefinition />
<ColumnDefinition Width="40"/>
</Grid.ColumnDefinitions>
<GridSplitter Grid.Column="2"
Width="5"
VerticalContentAlignment="Stretch"
ResizeDirection="Columns" />
</Grid> 展开
0-可变宽度
1-固定宽度20
2-GridSplitter
3-固定宽度20
4-可变宽度
5-固定宽度40
要实现的是拖动GridSplitter可以实现让0或者4缩小至接近0或者最大。其他的固定列不变。
<Grid ShowGridLines="True">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="20" />
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="20"/>
<ColumnDefinition />
<ColumnDefinition Width="40"/>
</Grid.ColumnDefinitions>
<GridSplitter Grid.Column="2"
Width="5"
VerticalContentAlignment="Stretch"
ResizeDirection="Columns" />
</Grid> 展开
1个回答
展开全部
<Grid ShowGridLines="True">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="auto"/>
<ColumnDefinition />
<ColumnDefinition Width="40"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="20"/>
</Grid.ColumnDefinitions>
<Rectangle Grid.Column="0" Fill="#FFDB5757" />
<Rectangle Grid.Column="1" Fill="#FF3BF29E" />
</Grid>
<Grid Grid.Column="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Rectangle Grid.Column="0" Fill="#FF3BF29E" />
<Rectangle Grid.Column="1" Fill="#FFDB5757" />
</Grid>
<Rectangle Grid.Column="3" Fill="Orange"/>
<GridSplitter Grid.Column="1" Width="5" VerticalContentAlignment="Stretch" ResizeBehavior="PreviousAndNext" />
</Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="auto"/>
<ColumnDefinition />
<ColumnDefinition Width="40"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="20"/>
</Grid.ColumnDefinitions>
<Rectangle Grid.Column="0" Fill="#FFDB5757" />
<Rectangle Grid.Column="1" Fill="#FF3BF29E" />
</Grid>
<Grid Grid.Column="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Rectangle Grid.Column="0" Fill="#FF3BF29E" />
<Rectangle Grid.Column="1" Fill="#FFDB5757" />
</Grid>
<Rectangle Grid.Column="3" Fill="Orange"/>
<GridSplitter Grid.Column="1" Width="5" VerticalContentAlignment="Stretch" ResizeBehavior="PreviousAndNext" />
</Grid>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询