RowDefinitionCollection.Insert(Int32, RowDefinition) Metoda

Definicja

Wstawia element RowDefinition na określonej pozycji indeksu w obiekcie 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)

Parametry

index
Int32

Pozycja w kolekcji, w której wstawiono element.

value
RowDefinition

Obiekt RowDefinition do wstawienia.

Implementuje

Wyjątki

index nie jest prawidłowym indeksem w obiekcie IList.

Przykłady

W poniższym przykładzie pokazano, jak za pomocą Insert metody wstawić element RowDefinition do określonej index pozycji w obiekcie 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

Aby wyświetlić kompletny przykład, zobacz Instrukcje: manipulowanie kolumnami i wierszami przy użyciu kolumnDefinitionsCollections i RowDefinitionsCollections.

Uwagi

RowDefinitionCollection używa systemu indeksowania opartego na zera.

Dotyczy

Zobacz też