#407 – Grid Contains Single Row and Column by Default

If you define a Grid, but do not define any rows or columns using the RowDefinitions and ColumnDefinitions properties, the resulting grid will contain a single row and a single column.

        <Button Content="I'm in a Grid" Margin="5"/>

Similarly, if you define a Grid and specify multiple columns using the ColumnDefinitions property, but not the RowDefinitions property, you’ll get a single row and the specified number of columns.  (The same is true for a single column and explicit number of rows).


        <Label Grid.Column="0" Content="Larry" Margin="10" Background="Lavender"/>
        <Label Grid.Column="1" Content="Moe" Margin="10" Background="Magenta"/>
        <Label Grid.Column="2" Content="Curly" Margin="10" Background="Cornsilk"/>


About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: