Grid Grid Grid Class

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 RowDefinitions and ColumnDefinitions attached properties) and other logic.

Syntax

Declaration

public class Gridpublic class GridPublic Class Grid
<Grid ...>
  oneOrMoreUIElements
</Grid>
-or-
<Grid .../>

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 BorderBrush, BorderThickness, CornerRadius, and 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 RowDefinitions, and one or more ColumnDefinition elements as the value of ColumnDefinitions. Then, you apply the RowDefinitions and ColumnDefinitions 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 Height for each RowDefinition and 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 RowSpanProperty or ColumnSpanProperty 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(Windows.UI.Xaml.FrameworkElement) and SetColumnSpan(Windows.UI.Xaml.FrameworkElement,System.Int32) methods support and provide the equivalent code-only support for ColumnSpanProperty. Alternatively, you can use the dependency property system to get or set the value of the attached property. Call GetValue(Windows.UI.Xaml.DependencyProperty) or SetValue(Windows.UI.Xaml.DependencyProperty,System.Object), 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.

Grid derived classes

Grid is the parent class for SwapChainPanel and SwapChainBackgroundPanel.

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

Constructors summary

Initializes a new instance of the Grid class.

Properties summary

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

Identifies the BorderBrush dependency property.

Gets or sets the border thickness of the panel.

Identifies the BorderThickness dependency property.

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

Identifies the ColumnDefinitions XAML attached property.

Identifies the ColumnSpanProperty XAML attached property.

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

Identifies the CornerRadius dependency property.

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

Identifies the Padding dependency property.

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

Identifies the RowDefinitions XAML attached property.

Identifies the RowSpanProperty XAML attached property.

Methods summary

Gets the value of the ColumnDefinitions XAML attached property from the specified FrameworkElement.

Gets the value of the ColumnSpanProperty XAML attached property from the specified FrameworkElement.

Gets the value of the RowDefinitions XAML attached property from the specified FrameworkElement.

Gets the value of the RowSpanProperty XAML attached property from the specified FrameworkElement.

Sets the value of the ColumnDefinitions XAML attached property on the specified FrameworkElement.

Sets the value of the ColumnSpanProperty XAML attached property on the specified FrameworkElement.

Sets the value of the RowDefinitions XAML attached property on the specified FrameworkElement.

Sets the value of the RowSpanProperty XAML attached property on the specified FrameworkElement.

Constructors

  • Grid()
    Grid()
    Grid()
    Grid()

    Initializes a new instance of the Grid class.

    public Grid()public Grid()Public Function Grid() As

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
    <Grid BorderBrush="{StaticResource resourceName}"/>
    
    

    Property Value

    • 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

    Property Value

  • 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
    <Grid BorderThickness="uniform"/>
    - or -
    <Grid BorderThickness="left&right,top&bottom"/>
    - or -
    <Grid BorderThickness="left,top,right,bottom"/>
    

    Property 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

    Property Value

  • 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
    <Grid>
      <Grid.ColumnDefinitions>
        oneOrMoreColumnDefinitions
      </Grid.ColumnDefinitions>
    </Grid>
    

    Property Value

    Remarks

    Examples

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

    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="250" />
        <ColumnDefinition Width="150" />
    </Grid.ColumnDefinitions>
    
  • ColumnProperty
    ColumnProperty
    ColumnProperty
    ColumnProperty

    Identifies the ColumnDefinitions XAML attached property.

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

    Property Value

    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 ColumnDefinitions XAML attached property in XAML and won't need this identifier.

  • ColumnSpanProperty
    ColumnSpanProperty
    ColumnSpanProperty
    ColumnSpanProperty

    Identifies the ColumnSpanProperty XAML attached property.

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

    Property Value

    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 ColumnSpanProperty 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
    <Grid CornerRadius="uniformRadius"/>
    - or -
    <Grid CornerRadius="topLeft,topRight,bottomRight,bottomLeft"/>
    
    

    Property Value

    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

    Property Value

  • 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

    Property Value

    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

    Property Value

  • 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
    <Grid>
      <Grid.RowDefinitions>
        oneOrMoreRowDefinitions
      </Grid.RowDefinitions>
    </Grid>
    

    Property Value

    Remarks

    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>
    
  • RowProperty
    RowProperty
    RowProperty
    RowProperty

    Identifies the RowDefinitions XAML attached property.

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

    Property Value

    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 RowDefinitions XAML attached property in XAML and won't need this identifier.

  • RowSpanProperty
    RowSpanProperty
    RowSpanProperty
    RowSpanProperty

    Identifies the RowSpanProperty XAML attached property.

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

    Property Value

    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 RowSpanProperty XAML attached property in XAML and won't need this identifier.

Methods

  • GetColumn(Windows.UI.Xaml.FrameworkElement)
    GetColumn(Windows.UI.Xaml.FrameworkElement)
    GetColumn(Windows.UI.Xaml.FrameworkElement)
    GetColumn(Windows.UI.Xaml.FrameworkElement)

    Gets the value of the ColumnDefinitions XAML attached property from the specified FrameworkElement.

    public static int GetColumn(Windows.UI.Xaml.FrameworkElement element)public static int GetColumn(Windows.UI.Xaml.FrameworkElement element)Public Static Function GetColumn(element As Windows.UI.Xaml.FrameworkElement) As int

    Parameters

    Returns

    • int
      int
      int

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

    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 ColumnDefinitions XAML attached property in XAML and won't need this method. For more info, see the ColumnDefinitions XAML attached property.

    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();
        
    }
    
  • GetColumnSpan(Windows.UI.Xaml.FrameworkElement)
    GetColumnSpan(Windows.UI.Xaml.FrameworkElement)
    GetColumnSpan(Windows.UI.Xaml.FrameworkElement)
    GetColumnSpan(Windows.UI.Xaml.FrameworkElement)

    Gets the value of the ColumnSpanProperty XAML attached property from the specified FrameworkElement.

    public static int GetColumnSpan(Windows.UI.Xaml.FrameworkElement element)public static int GetColumnSpan(Windows.UI.Xaml.FrameworkElement element)Public Static Function GetColumnSpan(element As Windows.UI.Xaml.FrameworkElement) As int

    Parameters

    Returns

    • int
      int
      int

      The value of the ColumnSpanProperty 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 ColumnSpanProperty XAML attached property in XAML and won't need this method. For more info, see the ColumnSpanProperty attached property.

  • GetRow(Windows.UI.Xaml.FrameworkElement)
    GetRow(Windows.UI.Xaml.FrameworkElement)
    GetRow(Windows.UI.Xaml.FrameworkElement)
    GetRow(Windows.UI.Xaml.FrameworkElement)

    Gets the value of the RowDefinitions XAML attached property from the specified FrameworkElement.

    public static int GetRow(Windows.UI.Xaml.FrameworkElement element)public static int GetRow(Windows.UI.Xaml.FrameworkElement element)Public Static Function GetRow(element As Windows.UI.Xaml.FrameworkElement) As int

    Parameters

    Returns

    • int
      int
      int

      The value of the RowDefinitions 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 RowDefinitions XAML attached property in XAML and won't need this method. For more info, see the RowDefinitions attached property.

  • GetRowSpan(Windows.UI.Xaml.FrameworkElement)
    GetRowSpan(Windows.UI.Xaml.FrameworkElement)
    GetRowSpan(Windows.UI.Xaml.FrameworkElement)
    GetRowSpan(Windows.UI.Xaml.FrameworkElement)

    Gets the value of the RowSpanProperty XAML attached property from the specified FrameworkElement.

    public static int GetRowSpan(Windows.UI.Xaml.FrameworkElement element)public static int GetRowSpan(Windows.UI.Xaml.FrameworkElement element)Public Static Function GetRowSpan(element As Windows.UI.Xaml.FrameworkElement) As int

    Parameters

    Returns

    • int
      int
      int

      The value of the RowSpanProperty 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 RowSpanProperty XAML attached property in XAML and won't need this method. For more info, see the RowSpanProperty attached property.

  • SetColumn(Windows.UI.Xaml.FrameworkElement,System.Int32)
    SetColumn(Windows.UI.Xaml.FrameworkElement,System.Int32)
    SetColumn(Windows.UI.Xaml.FrameworkElement,System.Int32)
    SetColumn(Windows.UI.Xaml.FrameworkElement,System.Int32)

    Sets the value of the ColumnDefinitions XAML attached property on the specified FrameworkElement.

    public static void SetColumn(Windows.UI.Xaml.FrameworkElement element,System.Int32 value)public static void SetColumn(Windows.UI.Xaml.FrameworkElement element,System.Int32 value)Public Static Function SetColumn(element As Windows.UI.Xaml.FrameworkElement,value As System.Int32) As void

    Parameters

    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 ColumnDefinitions XAML attached property in XAML and won't need this method. For more info, see the ColumnDefinitions XAML attached property.

  • SetColumnSpan(Windows.UI.Xaml.FrameworkElement,System.Int32)
    SetColumnSpan(Windows.UI.Xaml.FrameworkElement,System.Int32)
    SetColumnSpan(Windows.UI.Xaml.FrameworkElement,System.Int32)
    SetColumnSpan(Windows.UI.Xaml.FrameworkElement,System.Int32)

    Sets the value of the ColumnSpanProperty XAML attached property on the specified FrameworkElement.

    public static void SetColumnSpan(Windows.UI.Xaml.FrameworkElement element,System.Int32 value)public static void SetColumnSpan(Windows.UI.Xaml.FrameworkElement element,System.Int32 value)Public Static Function SetColumnSpan(element As Windows.UI.Xaml.FrameworkElement,value As System.Int32) As void

    Parameters

    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 ColumnSpanProperty XAML attached property in XAML and won't need this method. For more info, see the ColumnSpanProperty attached property.

  • SetRow(Windows.UI.Xaml.FrameworkElement,System.Int32)
    SetRow(Windows.UI.Xaml.FrameworkElement,System.Int32)
    SetRow(Windows.UI.Xaml.FrameworkElement,System.Int32)
    SetRow(Windows.UI.Xaml.FrameworkElement,System.Int32)

    Sets the value of the RowDefinitions XAML attached property on the specified FrameworkElement.

    public static void SetRow(Windows.UI.Xaml.FrameworkElement element,System.Int32 value)public static void SetRow(Windows.UI.Xaml.FrameworkElement element,System.Int32 value)Public Static Function SetRow(element As Windows.UI.Xaml.FrameworkElement,value As System.Int32) As void

    Parameters

    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 RowDefinitions XAML attached property in XAML and won't need this method. For more info, see the RowDefinitions attached property.

  • SetRowSpan(Windows.UI.Xaml.FrameworkElement,System.Int32)
    SetRowSpan(Windows.UI.Xaml.FrameworkElement,System.Int32)
    SetRowSpan(Windows.UI.Xaml.FrameworkElement,System.Int32)
    SetRowSpan(Windows.UI.Xaml.FrameworkElement,System.Int32)

    Sets the value of the RowSpanProperty XAML attached property on the specified FrameworkElement.

    public static void SetRowSpan(Windows.UI.Xaml.FrameworkElement element,System.Int32 value)public static void SetRowSpan(Windows.UI.Xaml.FrameworkElement element,System.Int32 value)Public Static Function SetRowSpan(element As Windows.UI.Xaml.FrameworkElement,value As System.Int32) As void

    Parameters

    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 RowSpanProperty XAML attached property in XAML and won't need this method. For more info, see the RowSpanProperty attached property.

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

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

Details

Assembly

Windows.UI.Xaml.Controls.dll