RowDefinitionCollection.Insert(Int32, RowDefinition) Method

Definition

Inserts a RowDefinition at the specified index position within a RowDefinitionCollection.

C#
public void Insert(int index, System.Windows.Controls.RowDefinition value);

Parameters

index
Int32

The position within the collection where the item is inserted.

value
RowDefinition

The RowDefinition to insert.

Implements

Exceptions

index is not a valid index in the IList.

Examples

The following example demonstrates how to use the Insert method to insert a RowDefinition to a specific index position within a RowDefinitionCollection.

C#
private void insertRowAt(object sender, RoutedEventArgs e)
{
    rowDef1 = new RowDefinition();
    grid1.RowDefinitions.Insert(grid1.RowDefinitions.Count, rowDef1);
    tp1.Text = "RowDefinition added at index position " + grid1.RowDefinitions.IndexOf(rowDef1).ToString();
}

To view the complete sample, see How to: Manipulate Columns and Rows by Using ColumnDefinitionsCollections and RowDefinitionsCollections.

Remarks

RowDefinitionCollection uses a zero-based indexing system.

Applies to

Produkt Verzie
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

See also