Grid.ColumnSpan Attached Property
Gets or sets a value that indicates the total number of columns that child content spans within a Grid.
Assembly: System.Windows (in System.Windows.dll)
'Declaration See GetColumnSpan, SetColumnSpan
See GetColumnSpan, SetColumnSpan
Dependency property identifier field: ColumnSpanProperty
Columns in a Grid are defined using the ColumnDefinition 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 three columns.
<TextBlock Margin="2" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="3" TextWrapping="Wrap"> This TextBlock is positioned in the first column and the first row (column 0, row 0) and spans across all three columns (ColumnSpan 3). </TextBlock>
Supported in: 5, 4, 3
Silverlight for Windows Phone
Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.