Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

RowDefinitionCollection.IndexOf Method

Returns the index position of a given RowDefinition within a RowDefinitionCollection.

Namespace:  System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

public int IndexOf(
	RowDefinition value
)

Parameters

value
Type: System.Windows.Controls.RowDefinition

The RowDefinition whose index position is desired.

Return Value

Type: System.Int32
The index of value if found in the collection; otherwise, -1.

Implements

IList<T>.IndexOf(T)

The following example demonstrates how to use the IndexOf method to determine the index position of a RowDefinition within a RowDefinitionCollection.

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.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft