RowDefinitionCollection.IndexOf(RowDefinition) Méthode

Définition

Retourne la position d'index d'un RowDefinition donné dans un 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

Paramètres

value
RowDefinition

RowDefinition dont la position d'index est souhaitée.

Retours

Int32

Index de value si celui-ci figure dans la collection, sinon -1.

Implémente

Exemples

L’exemple suivant montre comment utiliser la IndexOf méthode pour déterminer la position d’index d’un dans un RowDefinition 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

Pour afficher l’exemple complet, consultez Guide pratique pour manipuler des colonnes et des lignes à l’aide de ColumnDefinitionsCollections et rowDefinitionsCollections.

S’applique à

Voir aussi