RowDefinitionCollection.IndexOf(RowDefinition) Método

Definición

Devuelve la posición de índice de un determinado RowDefinition dentro de .RowDefinitionCollection

public:
 virtual int IndexOf(System::Windows::Controls::RowDefinition ^ value);
public int IndexOf(System.Windows.Controls.RowDefinition value);
abstract member IndexOf : System.Windows.Controls.RowDefinition -> int
override this.IndexOf : System.Windows.Controls.RowDefinition -> int
Public Function IndexOf (value As RowDefinition) As Integer

Parámetros

value
RowDefinition

cuya RowDefinition posición de índice se desea.

Devoluciones

Índice de value si se encuentra en la colección; de lo contrario, -1.

Implementaciones

Ejemplos

En el ejemplo siguiente se muestra cómo usar el IndexOf método para determinar la posición de índice de un RowDefinition objeto dentro de .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();
}
Private Sub insertRowAt(ByVal sender As Object, ByVal e As RoutedEventArgs)
    Dim rowDef1 As New RowDefinition
    grid1.RowDefinitions.Insert(grid1.RowDefinitions.Count, rowDef1)
    tp1.Text = "RowDefinition added at index position " + grid1.RowDefinitions.IndexOf(rowDef1).ToString()
End Sub

Para ver el ejemplo completo, vea Cómo: Manipular columnas y filas mediante ColumnDefinitionsCollections y RowDefinitionsCollections.

Se aplica a

Consulte también