I cannot distinguish the different between 'Auto' and '*' when setting width/height for a grid column. Please help!
在为网格列设置宽度/高度时,我无法区分'Auto'和'*'的区别。请帮助!
1 个解决方案
#1
135
We're talking in the context of WPF Grid here? My answer will talk about columns, but the same applies to rows.
我们讨论的是WPF网格的内容?我的回答将讨论列,但同样适用于行。
In brief: Auto means "size to column content", and *
means "size proportional to grid".
简而言之:Auto表示“大小与列内容”,*表示“大小与网格成比例”。
Auto means that a column is given as much width as the elements within it require.
Auto表示一个列的宽度和它所要求的元素一样多。
The width of *
sized columns is calculated by allocating space for the auto, and fixed width columns, and then dividing up the remaining space. So if there's only one *
sized column, it will get all the remaining space, if there were two they would get half each, etc. You can also change the proportion allocated to each star sized column. If column A had a size of 2*
and B had a size of 3*
then A would get two shares of the space and B would get 3 shares.
*大小的列的宽度是通过分配给汽车的空间和固定宽度的列来计算的,然后分割剩余的空间。所以如果只有一个* *大小的列,它会得到所有剩余的空间,如果有两个它们会得到一半,等等。你也可以改变分配给每个*大小的列的比例。如果列A的大小是2* B的大小是3*那么A会得到2份空间B会得到3份。
#1
135
We're talking in the context of WPF Grid here? My answer will talk about columns, but the same applies to rows.
我们讨论的是WPF网格的内容?我的回答将讨论列,但同样适用于行。
In brief: Auto means "size to column content", and *
means "size proportional to grid".
简而言之:Auto表示“大小与列内容”,*表示“大小与网格成比例”。
Auto means that a column is given as much width as the elements within it require.
Auto表示一个列的宽度和它所要求的元素一样多。
The width of *
sized columns is calculated by allocating space for the auto, and fixed width columns, and then dividing up the remaining space. So if there's only one *
sized column, it will get all the remaining space, if there were two they would get half each, etc. You can also change the proportion allocated to each star sized column. If column A had a size of 2*
and B had a size of 3*
then A would get two shares of the space and B would get 3 shares.
*大小的列的宽度是通过分配给汽车的空间和固定宽度的列来计算的,然后分割剩余的空间。所以如果只有一个* *大小的列,它会得到所有剩余的空间,如果有两个它们会得到一半,等等。你也可以改变分配给每个*大小的列的比例。如果列A的大小是2* B的大小是3*那么A会得到2份空间B会得到3份。