#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>


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 comment