RowDefinitionCollection.Insert(Int32, RowDefinition) Método

Definición

Inserta un RowDefinition objeto en la posición de índice especificada dentro de .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)

Parámetros

index
Int32

Posición dentro de la colección donde se inserta el elemento.

value
RowDefinition

que RowDefinition se va a insertar.

Implementaciones

Excepciones

indexno es un índice válido en .IList

Ejemplos

En el ejemplo siguiente se muestra cómo usar el Insert método para insertar un RowDefinition objeto en una posición específica index 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.

Comentarios

RowDefinitionCollection usa un sistema de indexación de base cero.

Se aplica a

Consulte también