格列宽 - 混合*(星号),汽车和填充左空间 [英] Grid Column Width - mix *(star), Auto and fill left space

查看:183
本文介绍了格列宽 - 混合*(星号),汽车和填充左空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网格宽度以下列定义:

I have a Grid width following Column Definitions:

<Grid.ColumnDefinitions>
        <ColumnDefinition MinWidth="320" MaxWidth="450" Width=".32*"/>
        <ColumnDefinition MinWidth="200" Width="Auto"/>
        <ColumnDefinition MinWidth="200" Width="Auto"/>
        <ColumnDefinition Width="Auto"/> <- (4) should fill all available space
        <ColumnDefinition MinWidth="250" MaxWidth="300" Width=".20*"/>
</Grid.ColumnDefinitions>

的问题是,设置宽度为自动上柱(4)归零它的宽度和最后一列是下一个,以第三个。我想有最后一列排列到应用程序的右边缘和前三个左侧。

The problem is that setting width to Auto on column (4) zeros it's width and last column is next to third one. I'd like to have last column aligned to right edge of app and first three to the left.

我也不能设置(4)宽度为星号(*) - 显然延伸相对于第一和最后一列

I also can't set (4) width to star(*) - obviously it stretches relatively to first and last column.

我一直在试图与horizo​​ntalalignments一段时间,但作为一个结果 - 内容不填充列宽。我也许可以绑定的内容宽度为列宽心向往之类的,但我很好奇是否有一些简单的方法才达到的(4)柱填补所有留下的空间。

I've been trying for a while with horizontalalignments but as a result - content is not filling the columns width. I could maybe bind content width to column width or sth like that, but I'm curious whether there is some easy way to achive the (4) column fill all left space.

推荐答案

我觉得你没有相当undestand的(*),它代表的加权平均。

I think you didnt quite undestand the (*) which stands for weighted average.

所以你的情况。

<Grid.ColumnDefinitions>
     <ColumnDefinition MinWidth="320" MaxWidth="450" Width="3*"/>
     <ColumnDefinition MinWidth="200" Width="Auto"/>
     <ColumnDefinition MinWidth="200" Width="Auto"/>
     <ColumnDefinition Width="5*"/>
     <ColumnDefinition MinWidth="250" MaxWidth="300" Width="2*"/>
 </Grid.ColumnDefinitions> 

如果你想使柱(4)小的降低*的权重,增加你喜欢的地方。

if you wish to make the column (4) small reduce the * weightage and increase where you like.

希望它可以帮助...

Hope it helps...

这篇关于格列宽 - 混合*(星号),汽车和填充左空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆