#416 – Setting Grid Rows and Columns to Autosize

When specifying the height of a row or the width of a column in a Grid, you can indicate that you want the row or column to automatically size to fit its content.  You can specify auto-sizing using the keyword “Auto” for the row height or column width.

    <Grid ShowGridLines="True">
    	<Grid.RowDefinitions>
    		<RowDefinition Height="Auto"/>
    		<RowDefinition/>
    	</Grid.RowDefinitions>

    	<Label Grid.Row="0" Content="Row 0 autosizes to this label" />
    	<Label Grid.Row="1" Content="Row 1 takes up the remaining space" />
	</Grid>


Advertisements

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

One Response to #416 – Setting Grid Rows and Columns to Autosize

  1. Pingback: Dew Drop – October 26, 2011 | Alvin Ashcraft's Morning Dew

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 )

Google+ photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s

%d bloggers like this: