RowDefinition RowDefinition RowDefinition Class

Defines row-specific properties that apply to Grid elements.

Syntax

Declaration

public sealed class RowDefinitionpublic sealed class RowDefinitionPublic NotInheritable Class RowDefinition
<RowDefinition .../>

Inheritance Hierarchy

Remarks

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 ColumnSpanProperty 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 summary

Initializes a new instance of the RowDefinition class.

Properties summary

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

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

Identifies the Height dependency property.

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

Identifies the MaxHeight dependency property.

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

Identifies the MinHeight dependency property.

Constructors

  • RowDefinition()
    RowDefinition()
    RowDefinition()
    RowDefinition()

    Initializes a new instance of the RowDefinition class.

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

Properties

  • ActualHeight
    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 doublepublic double ActualHeight { get; }

    Property Value

    • double
      double
      double

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

  • Height
    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 GridLengthpublic GridLength Height { get; set; }
    <RowDefinition Height="doubleValue"/>
    - or -
    <RowDefinition Height="starSizing"/>
    -or-
    <RowDefinition Height="Auto"/>
    

    Property Value

    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 Windows Store 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.

  • HeightProperty
    HeightProperty
    HeightProperty
    HeightProperty

    Identifies the Height dependency property.

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

    Property Value

  • MaxHeight
    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 doublepublic double MaxHeight { get; set; }
    <RowDefinition MaxHeight="double"/>
    

    Property Value

    • double
      double
      double

      A Double that represents the maximum height.

  • MaxHeightProperty
    MaxHeightProperty
    MaxHeightProperty
    MaxHeightProperty

    Identifies the MaxHeight dependency property.

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

    Property Value

  • MinHeight
    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 doublepublic double MinHeight { get; set; }
    <RowDefinition MinHeight="double"/>
    

    Property Value

    • double
      double
      double

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

  • MinHeightProperty
    MinHeightProperty
    MinHeightProperty
    MinHeightProperty

    Identifies the MinHeight dependency property.

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

    Property Value

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ActivatableAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.ThreadingAttribute
Windows.Foundation.Metadata.WebHostHiddenAttribute

Details

Assembly

Windows.UI.Xaml.Controls.dll