RowSpan Attached Property
Collapse the table of content
Expand the table of content

Grid.RowSpan Attached Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets or sets a value that indicates the total number of rows that child content spans within a Grid.

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.

See GetRowSpan, SetRowSpan
<object Grid.RowSpan="int"/>

Property Value

Type: System.Int32
An Int32 value that represents the number of rows that child content should span. The default value is 1.

Dependency property identifier field: RowSpanProperty

Rows in a Grid are defined using the RowDefinition element. You can span across multiple rows and columns using the Grid.RowSpan and Grid.ColumnSpan attached properties. The default value for both these properties is 1. The Grid will attempt to assign as many row spans or column spans as it can up to the amount specified by the Grid.RowSpan or Grid.ColumnSpan properties. If the position of an element is such that implementing the declared column span or row span value is untenable, the Grid will attempt to achieve the next best solution. For example, consider a 2 by 2 grid structure that has a rectangle in the position (1,1) and the rectangle is set with a Grid.ColumnSpan of 2. Since a column is not available to the right of the rectangle for such a span to be displayed, the rectangle is constrained to a single column and the rectangle's ActualWidth may be less than the Width you may have specified.

The following example displays a TextBlock that spans across two rows.


<Border Background="Transparent" BorderThickness="5" Grid.Row="2" Grid.Column="1" Grid.RowSpan="2" >
<TextBlock TextWrapping="Wrap">
    This TextBlock spans across two rows.
</TextBlock>
</Border>


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2018 Microsoft