RowDefinitionCollection.Insert(Int32, RowDefinition) Méthode

Définition

Insère un RowDefinition à la position d’index spécifiée dans un RowDefinitionCollection.

public:
 virtual void Insert(int index, System::Windows::Controls::RowDefinition ^ value);
public void Insert(int index, System.Windows.Controls.RowDefinition value);
abstract member Insert : int * System.Windows.Controls.RowDefinition -> unit
override this.Insert : int * System.Windows.Controls.RowDefinition -> unit
Public Sub Insert (index As Integer, value As RowDefinition)

Paramètres

index
Int32

Position dans la collection où l’élément est inséré.

value
RowDefinition

À RowDefinition insérer.

Implémente

Exceptions

index n’est pas un index valide dans le IList.

Exemples

L’exemple suivant montre comment utiliser la Insert méthode pour insérer une RowDefinition position spécifique index dans un 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 How to : Manipulate Columns and Rows by Using ColumnDefinitionsCollections and RowDefinitionsCollections.

Remarques

RowDefinitionCollection utilise un système d’indexation de base zéro.

S’applique à

Voir aussi