RowDefinitionCollection.Insert(Int32, RowDefinition) RowDefinitionCollection.Insert(Int32, RowDefinition) RowDefinitionCollection.Insert(Int32, RowDefinition) RowDefinitionCollection.Insert(Int32, RowDefinition) Method

定義

RowDefinition 插入 RowDefinitionCollection 內的指定索引位置。Inserts a RowDefinition at the specified index position within a 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)

參數

index
Int32 Int32 Int32 Int32

集合內插入項目的位置。The position within the collection where the item is inserted.

實作

例外狀況

範例

下列Insert範例示範如何使用方法, 將RowDefinition插入中RowDefinitionCollection的特定index位置。The following example demonstrates how to use the Insert method to insert a RowDefinition to a specific index position within a 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

若要查看完整的範例, 請參閱如何:使用 ColumnDefinitionsCollections 和 Rowdefinitionscollections 管理資料運算元據行和資料列。To view the complete sample, see How to: Manipulate Columns and Rows by Using ColumnDefinitionsCollections and RowDefinitionsCollections.

備註

RowDefinitionCollection使用以零為基底的索引系統。RowDefinitionCollection uses a zero-based indexing system.

適用於

另請參閱