RowDefinition Class
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Defines row-specific properties that apply to Grid elements.
Assembly: System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.
The RowDefinition type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | ActualHeight | Gets a value that represents the calculated height of the RowDefinition. |
![]() | Dispatcher | Gets the Dispatcher this object is associated with. (Inherited from DependencyObject.) |
![]() | Height | Gets the calculated height of a RowDefinition element, or sets the GridLength value of a row that is defined by the RowDefinition. |
![]() | MaxHeight | Gets or sets a value that represents the maximum height of a RowDefinition. |
![]() | MinHeight | Gets or sets a value that represents the minimum allowed height of a RowDefinition. |
| Name | Description | |
|---|---|---|
![]() | CheckAccess | Determines whether the calling thread has access to this object. (Inherited from DependencyObject.) |
![]() | ClearValue | Clears the local value of a dependency property. (Inherited from DependencyObject.) |
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetAnimationBaseValue | Returns any base value established for a Windows Phone dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | GetValue | Returns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ReadLocalValue | Returns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject.) |
![]() | SetValue | Sets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
| Name | Description | |
|---|---|---|
![]() ![]() | HeightProperty | Identifies the Height dependency property. |
![]() ![]() | MaxHeightProperty | Identifies the MaxHeight dependency property. |
![]() ![]() | MinHeightProperty | Identifies the MinHeight dependency property. |
You can set a RowDefinition for each row in a Grid. If you do not specify a RowDefinition, by default the Grid will contain a single row with star sized height.
To set a group of RowDefinition elements by using code, add the RowDefinition to a RowDefinitionCollection.
The RowDefinition class exposes only height properties. To set width properties in a Grid, create an instance of ColumnDefinition.
The following example uses three ColumnDefinitions and three RowDefinitions to create a grid that has nine cells, such as in a worksheet. Each cell contains a TextBlock element that represents data, and the top row contains a TextBlock with the ColumnSpan property applied. To show the boundaries of each cell, the ShowGridLines property is enabled.
<Grid Background="Transparent" VerticalAlignment="Top" HorizontalAlignment="Left" ShowGridLines="True" Width="350" Height="200"> <Grid.ColumnDefinitions> <ColumnDefinition /> <ColumnDefinition /> <ColumnDefinition /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition /> <RowDefinition /> <RowDefinition /> </Grid.RowDefinitions> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="20" FontWeight="Bold" Grid.ColumnSpan="3" Grid.Row="0">Expenses for 2007</TextBlock> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="15" FontWeight="Bold" Grid.Row="1" Grid.Column="0">Travel</TextBlock> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="15" FontWeight="Bold" Grid.Row="1" Grid.Column="1">Office Supplies</TextBlock> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="15" FontWeight="Bold" Grid.Row="1" Grid.Column="2">Salary</TextBlock> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="2" Grid.Column="0">20000</TextBlock> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="2" Grid.Column="1">10000</TextBlock> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="2" Grid.Column="2">50000</TextBlock> <TextBlock FontSize="16" FontWeight="Bold" Grid.ColumnSpan="3" Grid.Row="3">Total Expense: 80000</TextBlock> </Grid>




