Grid Grid Grid Grid Class

Definition

Some information relates to pre-released product which may be substantially modified before it’s commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Prerelease APIs are identified by a Prerelease label.

[Contains prerelease APIs.]
Defines a flexible grid area that consists of columns and rows. Child elements of the Grid are measured and arranged according to their row/column assignments (set by using Grid.Row and Grid.Column attached properties) and other logic.

public : class Grid : Panel, IGrid, IGrid2public class Grid : Panel, IGrid, IGrid2Public Class Grid Inherits Panel Implements IGrid, IGrid2// This API is not available in Javascript.
<Grid ...>
  oneOrMoreUIElements
</Grid>
-or-
<Grid .../>
Inheritance
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Inherited Members

Inherited properties

Inherited events

Inherited methods

Examples

This XAML example shows how to design a layout by using a Grid.

<Grid x:Name="LayoutRoot" Background="#555555" Width="400" Height="300">
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="250" />
        <ColumnDefinition Width="150" />
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="2*" />
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
    <TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" 
               Margin="10" FontWeight="Bold" 
               Text="Contoso Corporation" HorizontalAlignment="Center" VerticalAlignment="Center" />
    <Grid x:Name="FormLayoutGrid" Grid.Row="1" Grid.Column="0">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <TextBlock Grid.Row="0" Grid.Column="0" Text="First Name" Margin="10" 
                   HorizontalAlignment="Left" VerticalAlignment="Center" />
        <TextBox Grid.Row="0" Grid.Column="1" Margin="10" />
        <TextBlock Grid.Row="1" Grid.Column="0" Text="Last Name" Margin="10" 
                   HorizontalAlignment="Left" VerticalAlignment="Center" />
        <TextBox Grid.Row="1" Grid.Column="1" Margin="10" />
        <TextBlock Grid.Row="2" Grid.Column="0" Text="Address" Margin="10" 
                   HorizontalAlignment="Left" VerticalAlignment="Center" />
        <TextBox Grid.Row="2" Grid.Column="1" Margin="10" />
      
    </Grid>
 </Grid>
    public Page()
    {
        InitializeComponent();
        LayoutDesign();
    }

    private void LayoutDesign()
    {
        //Create Stackpanel for ListBox Control and its description
        StackPanel DeptStackPanel = new StackPanel();
        DeptStackPanel.Margin = new Thickness(10);

        LayoutRoot.Children.Add(DeptStackPanel);
        Grid.SetColumn(DeptStackPanel, 1);
        Grid.SetRow(DeptStackPanel, 1);

        TextBlock DeptListHeading = new TextBlock();
        DeptListHeading.Text = "Department";

        ListBox DeptList = new ListBox();
        DeptList.Items.Add("Finance");
        DeptList.Items.Add("Marketing");
        DeptList.Items.Add("Human Resources");
        DeptList.Items.Add("Payroll");

        DeptStackPanel.Children.Add(DeptListHeading);
        DeptStackPanel.Children.Add(DeptList);

        //Create StackPanel for buttons
        StackPanel ButtonsStackPanel = new StackPanel();
        ButtonsStackPanel.Margin = new Thickness(10);
        ButtonsStackPanel.Orientation = Orientation.Horizontal;
        ButtonsStackPanel.HorizontalAlignment = HorizontalAlignment.Center;

        LayoutRoot.Children.Add(ButtonsStackPanel);
        Grid.SetColumn(ButtonsStackPanel, 0);
        Grid.SetRow(ButtonsStackPanel, 2);
        Grid.SetColumnSpan(ButtonsStackPanel, 2);

        Button BackButton = new Button();
        BackButton.Content = "Back";
        BackButton.Width = 100;

        Button CancelButton = new Button();
        CancelButton.Content = "Cancel";
        CancelButton.Width = 100;

        Button NextButton = new Button();
        NextButton.Content = "Next";
        NextButton.Width = 100;

        ButtonsStackPanel.Children.Add(BackButton);
        ButtonsStackPanel.Children.Add(CancelButton);
        ButtonsStackPanel.Children.Add(NextButton);

        BackButton.Margin = new Thickness(10);
        CancelButton.Margin = new Thickness(10);
        NextButton.Margin = new Thickness(10);
    }
}
Partial Public Class Page
    Inherits UserControl

    Public Sub New()
        InitializeComponent()
        LayoutDesign()
    End Sub

    Private Sub LayoutDesign()
        'Create Stackpanel for ListBox Control and its description 
        Dim DeptStackPanel As New StackPanel()
        DeptStackPanel.Margin = New Thickness(10)

        LayoutRoot.Children.Add(DeptStackPanel)
        Grid.SetColumn(DeptStackPanel, 1)
        Grid.SetRow(DeptStackPanel, 1)

        Dim DeptListHeading As New TextBlock()
        DeptListHeading.Text = "Department"

        Dim DeptList As New ListBox()
        DeptList.Items.Add("Finance")
        DeptList.Items.Add("Marketing")
        DeptList.Items.Add("Human Resources")
        DeptList.Items.Add("Payroll")

        DeptStackPanel.Children.Add(DeptListHeading)
        DeptStackPanel.Children.Add(DeptList)

        'Create StackPanel for buttons 
        Dim ButtonsStackPanel As New StackPanel()
        ButtonsStackPanel.Margin = New Thickness(10)
        ButtonsStackPanel.Orientation = Orientation.Horizontal
        ButtonsStackPanel.HorizontalAlignment = HorizontalAlignment.Center

        LayoutRoot.Children.Add(ButtonsStackPanel)
        Grid.SetColumn(ButtonsStackPanel, 0)
        Grid.SetRow(ButtonsStackPanel, 2)
        Grid.SetColumnSpan(ButtonsStackPanel, 2)

        Dim BackButton As New Button()
        BackButton.Content = "Back"
        BackButton.Height = 30
        BackButton.Width = 100

        Dim CancelButton As New Button()
        CancelButton.Content = "Cancel"
        CancelButton.Height = 30
        CancelButton.Width = 100

        Dim NextButton As New Button()
        NextButton.Content = "Next"
        NextButton.Height = 30
        NextButton.Width = 100

        ButtonsStackPanel.Children.Add(BackButton)
        ButtonsStackPanel.Children.Add(CancelButton)
        ButtonsStackPanel.Children.Add(NextButton)

        BackButton.Margin = New Thickness(10)
        CancelButton.Margin = New Thickness(10)
        NextButton.Margin = New Thickness(10)
    End Sub
End Class

Remarks

Grid is a layout panel that supports arranging child elements in rows and columns.

Grid layout panel

Tip

Starting in Windows 10, Grid defines new border properties that let you draw a border around the Grid without using an additional Border element. The new properties are Grid.BorderBrush, Grid.BorderThickness, Grid.CornerRadius, and Grid.Padding.

<Grid BorderBrush="Red" BorderThickness="2" CornerRadius="10" Padding="12">
    <TextBlock Text="Hello World!"/>
</Grid>

You typically define layout behavior for a Grid in XAML by providing one or more RowDefinition elements as the value of Grid.RowDefinitions, and one or more ColumnDefinition elements as the value of Grid.ColumnDefinitions. Then, you apply the Grid.Row and Grid.Column attached properties to each of the element children of the Grid, to indicate which row/column combination is used to position that element within the parent Grid.

To set the height of rows and the width of columns, you set RowDefinition.Height for each RowDefinition and ColumnDefinition.Width for each ColumnDefinition. By default, each row or column divides layout space equally. You can change this behavior either by providing absolute pixel values, or a Star sizing that divides available space using a weighted factor. For more info on how to use Star sizing in a Grid, see Define layouts with XAML or GridLength. You also can use an Auto sizing that sizes to content.

To indicate that an element child should span multiple rows or multiple columns in the Grid, you can apply the Grid.RowSpan or Grid.ColumnSpan attached properties to child elements of a Grid.

By default, a Grid contains one row and one column.

Setting the Margin property on the child elements in a Grid sets the distance between the element and its grid cell boundaries. The HorizontalAlignment and VerticalAlignment properties describe how the child element should be positioned within the grid cell. You can precisely position child elements of a Grid by using a combination of the Margin property and alignment properties. If you need even more control over the layout of individual child elements, consider using VariableSizedWrapGrid.

WrapGrid is another similar layout panel that has the benefit of better handling for content that's too wide, which might be clipped by a regular Grid depending on values of other layout properties.

Grid XAML attached properties

Grid is the host service class for several XAML attached properties. These attached properties enable child elements to report how they should be positioned in their Grid parent.

Grid provides these attached properties for XAML usage:

In order to support XAML processor access to the attached properties, and also to expose equivalent get and set operations to code, each XAML attached property has a pair of Get and Set accessor methods. For example, the GetColumnSpan and SetColumnSpan methods support and provide the equivalent code-only support for Grid.ColumnSpan. Alternatively, you can use the dependency property system to get or set the value of the attached property. Call GetValue or SetValue, passing the arguments of the dependency property identifier to set, and a reference to the target object on which to get or set the value.

An element in the first column that spans multiple rows can affect the height of each spanned row even if the first row has enough height to accomodate the element, and subsequent spanned rows would otherwise have a height of 0. For example, the second row in this Grid has its height set to 0, so the blue rectangle would not typically be visible. In this case, you might expect that the red ellipse would not affect the second row because the first row is tall enough to contain the ellipse. However, the Grid calculates the MinHeight of each row to be enough to accomodate the red ellipse, and then spans the element across the rows. As a result, the second row is given a MinHeight of 50, the red ellipse is centered in the 150px span, and half of the blue rectangle is visible in the second row.

Note

(This example uses an element that spans columns, but also applies to an element in the first column that spans multiple rows.)

<Grid Background="Yellow" Width="300">
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="50"/>
        <ColumnDefinition Width="*"/>
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="0"/>
    </Grid.RowDefinitions>
    <Ellipse   Grid.Row="0" Grid.Column="0"  Height="50" Fill="Red" Grid.RowSpan="2"/>
    <Rectangle Grid.Row="0" Grid.Column="1" Fill="Green" Height="100"/>
    <Rectangle Grid.Row="1" Grid.Column="1" Fill="Blue" Height="100"/>
</Grid>

Grid derived classes

Grid is the parent class for SwapChainPanel and SwapChainBackgroundPanel.

Constructors

Grid() Grid() Grid() Grid()

Initializes a new instance of the Grid class.

public : Grid()public Grid()Public Sub New()// This API is not available in Javascript.

Properties

BorderBrush BorderBrush BorderBrush BorderBrush

Gets or sets a brush that describes the border fill of the panel.

public : Brush BorderBrush { get; set; }public Brush BorderBrush { get; set; }Public ReadWrite Property BorderBrush As Brush// This API is not available in Javascript.
<Grid BorderBrush="{StaticResource resourceName}"/>

Value
Brush Brush Brush Brush

The brush that is used to fill the panel's border. The default is null, (a null brush) which is evaluated as Transparent for rendering.

Remarks

The BorderThickness value must be greater than 0 in order to see the BorderBrush value take effect.

BorderBrushProperty BorderBrushProperty BorderBrushProperty BorderBrushProperty

Identifies the BorderBrush dependency property.

public : static DependencyProperty BorderBrushProperty { get; }public static DependencyProperty BorderBrushProperty { get; }Public Static ReadOnly Property BorderBrushProperty As DependencyProperty// This API is not available in Javascript.
Value
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

The identifier for the BorderBrush dependency property.

See Also

BorderThickness BorderThickness BorderThickness BorderThickness

Gets or sets the border thickness of the panel.

public : Thickness BorderThickness { get; set; }public Thickness BorderThickness { get; set; }Public ReadWrite Property BorderThickness As Thickness// This API is not available in Javascript.
<Grid BorderThickness="uniform"/>
- or -
<Grid BorderThickness="left&right,top&bottom"/>
- or -
<Grid BorderThickness="left,top,right,bottom"/>
Value
Thickness Thickness Thickness Thickness

The border thickness of the panel, as a Thickness value.

BorderThicknessProperty BorderThicknessProperty BorderThicknessProperty BorderThicknessProperty

Identifies the BorderThickness dependency property.

public : static DependencyProperty BorderThicknessProperty { get; }public static DependencyProperty BorderThicknessProperty { get; }Public Static ReadOnly Property BorderThicknessProperty As DependencyProperty// This API is not available in Javascript.
See Also

ColumnDefinitions ColumnDefinitions ColumnDefinitions ColumnDefinitions

Gets a list of ColumnDefinition objects defined on this instance of Grid.

public : ColumnDefinitionCollection ColumnDefinitions { get; }public ColumnDefinitionCollection ColumnDefinitions { get; }Public ReadOnly Property ColumnDefinitions As ColumnDefinitionCollection// This API is not available in Javascript.
<Grid>
  <Grid.ColumnDefinitions>
    oneOrMoreColumnDefinitions
  </Grid.ColumnDefinitions>
</Grid>

Examples

The following example creates a Grid with two columns by using ColumnDefinition s.

<Grid.ColumnDefinitions>
    <ColumnDefinition Width="250" />
    <ColumnDefinition Width="150" />
</Grid.ColumnDefinitions>
See Also

ColumnProperty ColumnProperty ColumnProperty ColumnProperty

Identifies the Grid.Column XAML attached property.

public : static DependencyProperty ColumnProperty { get; }public static DependencyProperty ColumnProperty { get; }Public Static ReadOnly Property ColumnProperty As DependencyProperty// This API is not available in Javascript.
Value
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

The identifier for the Grid.Column XAML attached property.

Remarks

This property is only an identifier for the property system, and isn't used in most app scenarios. In most cases you set the Grid.Column XAML attached property in XAML and won't need this identifier.

ColumnSpacing ColumnSpacing ColumnSpacing ColumnSpacing

Prerelease. Gets or sets the distance (in pixels) between grid columns.

public : double ColumnSpacing { get; set; }public double ColumnSpacing { get; set; }Public ReadWrite Property ColumnSpacing As double// This API is not available in Javascript.
<Grid ColumnSpacing="double" .../>

Value
double double double double

The distance (in pixels) between grid columns.

Additional features and requirements
Device family
Windows 10 Insider Preview (introduced v10.0.16225.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

ColumnSpacingProperty ColumnSpacingProperty ColumnSpacingProperty ColumnSpacingProperty

Prerelease. Identifies the ColumnSpacing dependency property.

public : static DependencyProperty ColumnSpacingProperty { get; }public static DependencyProperty ColumnSpacingProperty { get; }Public Static ReadOnly Property ColumnSpacingProperty As DependencyProperty// This API is not available in Javascript.
Value
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

The identifier for the ColumnSpacing dependency property.

Additional features and requirements
Device family
Windows 10 Insider Preview (introduced v10.0.16225.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

ColumnSpanProperty ColumnSpanProperty ColumnSpanProperty ColumnSpanProperty

Identifies the Grid.ColumnSpan XAML attached property.

public : static DependencyProperty ColumnSpanProperty { get; }public static DependencyProperty ColumnSpanProperty { get; }Public Static ReadOnly Property ColumnSpanProperty As DependencyProperty// This API is not available in Javascript.
Value
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

The identifier for the Grid.ColumnSpan XAML attached property.

Remarks

This property is only an identifier for the property system, and isn't used in most app scenarios. In most cases you set the Grid.ColumnSpan XAML attached property in XAML and won't need this identifier.

CornerRadius CornerRadius CornerRadius CornerRadius

Gets or sets the radius for the corners of the panel's border.

public : CornerRadius CornerRadius { get; set; }public CornerRadius CornerRadius { get; set; }Public ReadWrite Property CornerRadius As CornerRadius// This API is not available in Javascript.
<Grid CornerRadius="uniformRadius"/>
- or -
<Grid CornerRadius="topLeft,topRight,bottomRight,bottomLeft"/>

Value
CornerRadius CornerRadius CornerRadius CornerRadius

The degree to which the corners are rounded, expressed as values of the CornerRadius structure.

Remarks

Member components of a CornerRadius value cannot be negative.

CornerRadiusProperty CornerRadiusProperty CornerRadiusProperty CornerRadiusProperty

Identifies the CornerRadius dependency property.

public : static DependencyProperty CornerRadiusProperty { get; }public static DependencyProperty CornerRadiusProperty { get; }Public Static ReadOnly Property CornerRadiusProperty As DependencyProperty// This API is not available in Javascript.
Value
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

The identifier for the CornerRadius dependency property.

See Also

Padding Padding Padding Padding

Gets or sets the distance between the border and its child object.

public : Thickness Padding { get; set; }public Thickness Padding { get; set; }Public ReadWrite Property Padding As Thickness// This API is not available in Javascript.
Value
Thickness Thickness Thickness Thickness

The dimensions of the space between the border and its child as a Thickness value. Thickness is a structure that stores dimension values using pixel measures.

Remarks

A related property is Margin (a property of FrameworkElement ). For more info about the relationship between margin and padding, see Alignment, margin, and padding or Define layouts with XAML.

PaddingProperty PaddingProperty PaddingProperty PaddingProperty

Identifies the Padding dependency property.

public : static DependencyProperty PaddingProperty { get; }public static DependencyProperty PaddingProperty { get; }Public Static ReadOnly Property PaddingProperty As DependencyProperty// This API is not available in Javascript.
Value
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

The identifier for the Padding dependency property.

See Also

RowDefinitions RowDefinitions RowDefinitions RowDefinitions

Gets a list of RowDefinition objects defined on this instance of Grid.

public : RowDefinitionCollection RowDefinitions { get; }public RowDefinitionCollection RowDefinitions { get; }Public ReadOnly Property RowDefinitions As RowDefinitionCollection// This API is not available in Javascript.
<Grid>
  <Grid.RowDefinitions>
    oneOrMoreRowDefinitions
  </Grid.RowDefinitions>
</Grid>

Examples

The following example creates a Grid with three rows. The Height of the first row is set to the value Auto, which distributes height evenly based on the size of the content that is within that row. The height of the second row and third row are set to 2* and * respectively. The second row gets 2/3 of the remaining space and the third row gets 1/3.

<Grid.RowDefinitions>
    <RowDefinition Height="Auto" />
    <RowDefinition Height="2*" />
    <RowDefinition Height="*"/>
</Grid.RowDefinitions>
See Also

RowProperty RowProperty RowProperty RowProperty

Identifies the Grid.Row XAML attached property.

public : static DependencyProperty RowProperty { get; }public static DependencyProperty RowProperty { get; }Public Static ReadOnly Property RowProperty As DependencyProperty// This API is not available in Javascript.
Value
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

The identifier for the Grid.Row XAML attached property.

Remarks

This property is only an identifier for the property system, and isn't used in most app scenarios. In most cases you set the Grid.Row XAML attached property in XAML and won't need this identifier.

RowSpacing RowSpacing RowSpacing RowSpacing

Prerelease. Gets or sets the distance (in pixels) between grid rows.

public : double RowSpacing { get; set; }public double RowSpacing { get; set; }Public ReadWrite Property RowSpacing As double// This API is not available in Javascript.
<Grid RowSpacing="double" .../>

Value
double double double double

The distance (in pixels) between grid rows.

Additional features and requirements
Device family
Windows 10 Insider Preview (introduced v10.0.16225.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

RowSpacingProperty RowSpacingProperty RowSpacingProperty RowSpacingProperty

Prerelease. Identifies the RowSpacing dependency property.

public : static DependencyProperty RowSpacingProperty { get; }public static DependencyProperty RowSpacingProperty { get; }Public Static ReadOnly Property RowSpacingProperty As DependencyProperty// This API is not available in Javascript.
Value
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

The identifier for the RowSpacing dependency property.

Additional features and requirements
Device family
Windows 10 Insider Preview (introduced v10.0.16225.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

RowSpanProperty RowSpanProperty RowSpanProperty RowSpanProperty

Identifies the Grid.RowSpan XAML attached property.

public : static DependencyProperty RowSpanProperty { get; }public static DependencyProperty RowSpanProperty { get; }Public Static ReadOnly Property RowSpanProperty As DependencyProperty// This API is not available in Javascript.
Value
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

The identifier for the Grid.RowSpan XAML attached property.

Remarks

This property is only an identifier for the property system, and isn't used in most app scenarios. In most cases you set the Grid.RowSpan XAML attached property in XAML and won't need this identifier.

Methods

GetColumn(FrameworkElement) GetColumn(FrameworkElement) GetColumn(FrameworkElement) GetColumn(FrameworkElement)

Gets the value of the Grid.Column XAML attached property from the specified FrameworkElement.

public : static int GetColumn(FrameworkElement element)public static int GetColumn(FrameworkElement element)Public Static Function GetColumn(element As FrameworkElement) As int// This API is not available in Javascript.
Parameters
element
FrameworkElement FrameworkElement FrameworkElement FrameworkElement

The element from which to read the property value.

Returns
int int int int

The value of the Grid.Column XAML attached property on the target element. This is a zero-based index.

Examples

The following example shows how to get the row and column of the element that raised an event.

<Grid x:Name="LayoutRoot">
    <Grid.Resources>
        <Style TargetType="TextBlock">
            <Setter Property="Foreground" Value="Black"/>
        </Style>
    </Grid.Resources>
    <Grid.ColumnDefinitions>
        <ColumnDefinition />
        <ColumnDefinition />
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition />
        <RowDefinition />  
    </Grid.RowDefinitions>
    
    <Rectangle Fill="White" Height="100" Width="100" Grid.Row="0" Grid.Column="0" 
               PointerEntered="r1_PointerEntered"/>
    <Rectangle Fill="Yellow" Height="100" Width="100" Grid.Row="0" Grid.Column="1" 
               PointerEntered="r1_PointerEntered" />
    <Rectangle Fill="Blue" Height="100" Width="100" Grid.Row="1" Grid.Column="0" 
               PointerEntered="r1_PointerEntered" />
    <Rectangle Fill="Green" Height="100" Width="100" Grid.Row="1" Grid.Column="1" 
               PointerEntered="r1_PointerEntered"/>
    <StackPanel >
        <StackPanel Orientation="Horizontal" >
        <TextBlock Text="Row = " />
        <TextBlock x:Name="txtRow"  />
    </StackPanel>
    <StackPanel Orientation="Horizontal" >
        <TextBlock Text="Column = " />
        <TextBlock x:Name="txtCol"  />
    </StackPanel>
        </StackPanel>
</Grid>
private void r1_PointerEntered(object sender, PointerRoutedEventArgs e)
{
    Rectangle r = (Rectangle)sender;
    int row = Grid.GetRow(r);
    int col = Grid.GetColumn(r);

    txtRow.Text = row.ToString();
    txtCol.Text = col.ToString();
    
}

Remarks

This method is a utility method for the property system, and isn't used in most app scenarios. In most cases you set the Grid.Column XAML attached property in XAML and won't need this method. For more info, see the Grid.Column XAML attached property.

See Also

GetColumnSpan(FrameworkElement) GetColumnSpan(FrameworkElement) GetColumnSpan(FrameworkElement) GetColumnSpan(FrameworkElement)

Gets the value of the Grid.ColumnSpan XAML attached property from the specified FrameworkElement.

public : static int GetColumnSpan(FrameworkElement element)public static int GetColumnSpan(FrameworkElement element)Public Static Function GetColumnSpan(element As FrameworkElement) As int// This API is not available in Javascript.
Parameters
element
FrameworkElement FrameworkElement FrameworkElement FrameworkElement

The element from which to read the property value.

Returns
int int int int

The value of the Grid.ColumnSpan XAML attached property on the target element.

Remarks

This method is a utility method for the property system, and isn't used in most app scenarios. In most cases you set the Grid.ColumnSpan XAML attached property in XAML and won't need this method. For more info, see the Grid.ColumnSpan attached property.

See Also

GetRow(FrameworkElement) GetRow(FrameworkElement) GetRow(FrameworkElement) GetRow(FrameworkElement)

Gets the value of the Grid.Row XAML attached property from the specified FrameworkElement.

public : static int GetRow(FrameworkElement element)public static int GetRow(FrameworkElement element)Public Static Function GetRow(element As FrameworkElement) As int// This API is not available in Javascript.
Parameters
element
FrameworkElement FrameworkElement FrameworkElement FrameworkElement

The element from which to read the property value.

Returns
int int int int

The value of the Grid.Row XAML attached property on the target element.

Remarks

This method is a utility method for the property system, and isn't used in most app scenarios. In most cases you set the Grid.Row XAML attached property in XAML and won't need this method. For more info, see the Grid.Row attached property.

See Also

GetRowSpan(FrameworkElement) GetRowSpan(FrameworkElement) GetRowSpan(FrameworkElement) GetRowSpan(FrameworkElement)

Gets the value of the Grid.RowSpan XAML attached property from the specified FrameworkElement.

public : static int GetRowSpan(FrameworkElement element)public static int GetRowSpan(FrameworkElement element)Public Static Function GetRowSpan(element As FrameworkElement) As int// This API is not available in Javascript.
Parameters
element
FrameworkElement FrameworkElement FrameworkElement FrameworkElement

The element from which to read the property value.

Returns
int int int int

The value of the Grid.RowSpan XAML attached property on the target element.

Remarks

This method is a utility method for the property system, and isn't used in most app scenarios. In most cases you set the Grid.RowSpan XAML attached property in XAML and won't need this method. For more info, see the Grid.RowSpan attached property.

See Also

SetColumn(FrameworkElement, Int32) SetColumn(FrameworkElement, Int32) SetColumn(FrameworkElement, Int32) SetColumn(FrameworkElement, Int32)

Sets the value of the Grid.Column XAML attached property on the specified FrameworkElement.

public : static void SetColumn(FrameworkElement element, int value)public static void SetColumn(FrameworkElement element, Int32 value)Public Static Function SetColumn(element As FrameworkElement, value As Int32) As void// This API is not available in Javascript.
Parameters
element
FrameworkElement FrameworkElement FrameworkElement FrameworkElement

The target element on which to set the Grid.Column XAML attached property.

value
int Int32 Int32 Int32

The property value to set.

Remarks

This method is a utility method for the property system, and isn't used in most app scenarios. In most cases you set the Grid.Column XAML attached property in XAML and won't need this method. For more info, see the Grid.Column XAML attached property.

See Also

SetColumnSpan(FrameworkElement, Int32) SetColumnSpan(FrameworkElement, Int32) SetColumnSpan(FrameworkElement, Int32) SetColumnSpan(FrameworkElement, Int32)

Sets the value of the Grid.ColumnSpan XAML attached property on the specified FrameworkElement.

public : static void SetColumnSpan(FrameworkElement element, int value)public static void SetColumnSpan(FrameworkElement element, Int32 value)Public Static Function SetColumnSpan(element As FrameworkElement, value As Int32) As void// This API is not available in Javascript.
Parameters
element
FrameworkElement FrameworkElement FrameworkElement FrameworkElement

The element on which to set the Grid.ColumnSpan XAML attached property.

value
int Int32 Int32 Int32

The property value to set.

Remarks

This method is a utility method for the property system, and isn't used in most app scenarios. In most cases you set the Grid.ColumnSpan XAML attached property in XAML and won't need this method. For more info, see the Grid.ColumnSpan attached property.

See Also

SetRow(FrameworkElement, Int32) SetRow(FrameworkElement, Int32) SetRow(FrameworkElement, Int32) SetRow(FrameworkElement, Int32)

Sets the value of the Grid.Row XAML attached property on the specified FrameworkElement.

public : static void SetRow(FrameworkElement element, int value)public static void SetRow(FrameworkElement element, Int32 value)Public Static Function SetRow(element As FrameworkElement, value As Int32) As void// This API is not available in Javascript.
Parameters
element
FrameworkElement FrameworkElement FrameworkElement FrameworkElement

The target element on which to set the Grid.Row XAML attached property.

value
int Int32 Int32 Int32

The property value to set.

Remarks

This method is a utility method for the property system, and isn't used in most app scenarios. In most cases you set the Grid.Row XAML attached property in XAML and won't need this method. For more info, see the Grid.Row attached property.

See Also

SetRowSpan(FrameworkElement, Int32) SetRowSpan(FrameworkElement, Int32) SetRowSpan(FrameworkElement, Int32) SetRowSpan(FrameworkElement, Int32)

Sets the value of the Grid.RowSpan XAML attached property on the specified FrameworkElement.

public : static void SetRowSpan(FrameworkElement element, int value)public static void SetRowSpan(FrameworkElement element, Int32 value)Public Static Function SetRowSpan(element As FrameworkElement, value As Int32) As void// This API is not available in Javascript.
Parameters
element
FrameworkElement FrameworkElement FrameworkElement FrameworkElement

The target element on which to set the Grid.RowSpan XAML attached property.

value
int Int32 Int32 Int32

The property value to set.

Remarks

This method is a utility method for the property system, and isn't used in most app scenarios. In most cases you set the Grid.RowSpan XAML attached property in XAML and won't need this method. For more info, see the Grid.RowSpan attached property.

See Also

See Also