RowDefinition RowDefinition RowDefinition Class

Definition

Defines row-specific properties that apply to Grid elements.

public : sealed class RowDefinition : DependencyObject, IRowDefinition
public sealed class RowDefinition : DependencyObject, IRowDefinition
Public NotInheritable Class RowDefinition Inherits DependencyObject Implements IRowDefinition
<RowDefinition .../>

Inheritance
RowDefinitionRowDefinitionRowDefinition
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Examples

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.

<Grid  VerticalAlignment="Top" HorizontalAlignment="Left"
       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>

Constructors

RowDefinition() RowDefinition() RowDefinition()

Initializes a new instance of the RowDefinition class.

public : RowDefinition()
public RowDefinition()
Public Sub New()

Properties

ActualHeight ActualHeight ActualHeight

Gets a value that represents the calculated height of the RowDefinition.

public : double ActualHeight { get; }
public double ActualHeight { get; }
Public ReadOnly Property ActualHeight As double
Value
double double double

A value that represents the calculated height in pixels. The default value is 0.

Dispatcher Dispatcher Dispatcher

Inherited from DependencyObject

Height Height Height

Gets the calculated height of a RowDefinition element, or sets the GridLength value of a row that is defined by the RowDefinition.

public : GridLength Height { get; set; }
public GridLength Height { get; set; }
Public ReadWrite Property Height As GridLength
<RowDefinition Height="doubleValue"/>
- or -
<RowDefinition Height="starSizing"/>
-or-
<RowDefinition Height="Auto"/>
Value
GridLength GridLength GridLength

The GridLength that represents the height of the row. The default value is a GridLength representing a "1*" sizing.

Remarks

The default value of Width is a GridLength representing a "1" sizing. This structure value has a **Value* data value of 1.0, and a GridUnitType data value of Star. With this default, each new RowDefinition you define for a Grid will have "1*" sizing, and each will be allotted an equal number of pixels for height of its content in layout handling. It's not uncommon to define RowDefinition as an object element in XAML without any attributes set and to just use this default behavior. The same is true for ColumnDefinition.

The value you set for Height can be constrained if you also set a value for MinHeight or MaxHeight. Each of these properties can take only pixel measurements, not Star sizing. If a RowDefinition uses Star or Auto sizing but also has MinHeight or MaxHeight constraints, the MinHeight or MaxHeight must be honored by the Grid layout behavior, even if that means giving or taking layout space from other Star sizing rows defined in the Grid that don't have constraints.

It's more common to use Star sizing than absolute pixel values for a Grid definition in a UWP app using C++, C#, or Visual Basic. Star sizing supports the dynamic layout concept, which helps your app look great on screens with different sizes, pixel densities and orientations. For more info, see Define layouts with XAML.

See Also

HeightProperty HeightProperty HeightProperty

Identifies the Height dependency property.

public : static DependencyProperty HeightProperty { get; }
public static DependencyProperty HeightProperty { get; }
Public Static ReadOnly Property HeightProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the Height dependency property.

MaxHeight MaxHeight MaxHeight

Gets or sets a value that represents the maximum height of a RowDefinition.

public : double MaxHeight { get; set; }
public double MaxHeight { get; set; }
Public ReadWrite Property MaxHeight As double
<RowDefinition MaxHeight="double"/>
Value
double double double

A Double that represents the maximum height.

MaxHeightProperty MaxHeightProperty MaxHeightProperty

Identifies the MaxHeight dependency property.

public : static DependencyProperty MaxHeightProperty { get; }
public static DependencyProperty MaxHeightProperty { get; }
Public Static ReadOnly Property MaxHeightProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the MaxHeight dependency property.

MinHeight MinHeight MinHeight

Gets or sets a value that represents the minimum allowed height of a RowDefinition.

public : double MinHeight { get; set; }
public double MinHeight { get; set; }
Public ReadWrite Property MinHeight As double
<RowDefinition MinHeight="double"/>
Value
double double double

A Double that represents the minimum allowed height. The default value is 0.

MinHeightProperty MinHeightProperty MinHeightProperty

Identifies the MinHeight dependency property.

public : static DependencyProperty MinHeightProperty { get; }
public static DependencyProperty MinHeightProperty { get; }
Public Static ReadOnly Property MinHeightProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the MinHeight dependency property.

Methods

ClearValue(DependencyProperty) ClearValue(DependencyProperty) ClearValue(DependencyProperty)

Inherited from DependencyObject

GetAnimationBaseValue(DependencyProperty) GetAnimationBaseValue(DependencyProperty) GetAnimationBaseValue(DependencyProperty)

Inherited from DependencyObject

GetValue(DependencyProperty) GetValue(DependencyProperty) GetValue(DependencyProperty)

Inherited from DependencyObject

ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty)

Inherited from DependencyObject

RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback) RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback) RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback)

Inherited from DependencyObject

SetValue(DependencyProperty,Object) SetValue(DependencyProperty,Object) SetValue(DependencyProperty,Object)

Inherited from DependencyObject

UnregisterPropertyChangedCallback(DependencyProperty,Int64) UnregisterPropertyChangedCallback(DependencyProperty,Int64) UnregisterPropertyChangedCallback(DependencyProperty,Int64)

Inherited from DependencyObject

See Also