RowDefinitionCollection.Insert(Int32, RowDefinition) Método

Definición

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

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

value
RowDefinition

RowDefinition que se va a insertar.

Implementaciones

Excepciones

index no es un índice válido para IList.

Ejemplos

En el ejemplo siguiente se muestra cómo usar el Insert método para insertar en RowDefinition 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