How many pixel from 1 star (GridUnitType.Star) in WPF

521 views Asked by At

I found here

var gridLength = new GridLength(1, GridUnitType.Star);

I want to know, 1 star = ? pixel

I was reached on the Internet, but I couldn't found any threads about this

Thanks.

1

There are 1 answers

0
Liero On

Star is relative unit, similar to % in css, but slightly different

//will split the grid into two columns with equal width
<ColumnDefinition Width="1*" /> //the same as Width="*"
<ColumnDefinition Width="1*" />


//will split the grid into two columns with ratio 1:2 
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="2*" />

//will split the grid into two columns, first 50px (fixed), second the rest of the grid
<ColumnDefinition Width="50" />
<ColumnDefinition Width="*" />

//will split the grid into three columns, first 50px, and the rest of the grid splitted with ratio 2:2, which is the same as 1:1
<ColumnDefinition Width="50" /> 
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="2*" />