What do the following column/row measurements mean?

Asked

Viewed 76 times

3

In creating rows or columns of WPF, which means each of these measures?

<Grid.ColumnDefinitions>
  <ColumnDefinition Width="50"/>
  <ColumnDefinition Width="50*"/>
  <ColumnDefinition Width="*"/>
  <ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
  • 50 - I know it is a fixed measure.
  • 50*
  • *
  • Auto

1 answer

4


The asterisk indicates that the size should be proportional. The calculation is based on all values found in all asterisks of that group of elements.

In a way, it’s the way you use percentage indirectly. 100% is the sum of all the numbers in the group and the percentage of each is proportional according to its individual value. Some people like to ensure that the sum always results in 100, which is equivalent to the percentage.

When you have elements of fixed size - and consider that the Auto has fixed size, this space is used independently. Only asterisks are considered in this count.

  • 50* - here is using 50 units (no matter which unit is, it is only one number)
  • * - when you don’t use a number is the same as using 1
  • Auto - size will be adjustable according to what you have in the element, it may vary if the internal "die" of it varies

In this example the first element will have 50 units and the last will only be known according to data within it. It is known that the second element will be 50 times larger than the third element. So within the space that remains for these two elements more than 98% will be occupied by the second element and less than 2% will be occupied by the third.

Remember that the WPF does not work with fixed amount of points, it is calculated according to the need. This unit used is totally virtual.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.