1

I've frequently seen these two definitions for columns:

            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>

and

                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>

As I understand it, both divide a grid into two columns with the same width. Are there any differences or conventions?

AymenDaoudi
  • 7,811
  • 9
  • 52
  • 84
  • @tnw Yes, I've read about asterisk but was wondering the difference between that and leaving the definition blank. –  Feb 19 '14 at 18:21

1 Answers1

1

Direct answer : There is no difference between those two.

Detailed answer :

The Star (*) value distributes the available space in the Grid by weighted proportions. The proportions you gave here are the same for both ColumnDefinitions, That means that the first column as well as the second will take the same proportion equally because the value is the same and which is one *.

Now when you don't set the value of the width, and because it is described by the GridUnitType enum, XAML will automatically set it to Star which is its default value.

AymenDaoudi
  • 7,811
  • 9
  • 52
  • 84