RowDefinitionCollection.RemoveAt(Int32) 方法

定義

RowDefinition 的指定索引位置移除 RowDefinitionCollection

public:
 virtual void RemoveAt(int index);
public void RemoveAt (int index);
abstract member RemoveAt : int -> unit
override this.RemoveAt : int -> unit
Public Sub RemoveAt (index As Integer)

參數

index
Int32

要移除之 RowDefinition 在集合內的位置。

實作

範例

下列範例示範如何使用 RemoveAt 方法,將 移除 RowDefinition 在特定 RowDefinitionCollection 位置的 index

private void removeRow(object sender, RoutedEventArgs e)
{
    if (grid1.RowDefinitions.Count <= 0)
    {
        tp1.Text = "No More Rows to Remove!";
    }
    else
    {
        grid1.RowDefinitions.RemoveAt(0);
    }
}
Private Sub removeRow(ByVal sender As Object, ByVal e As RoutedEventArgs)
    If (grid1.RowDefinitions.Count <= 0) Then
        tp1.Text = "No More Rows to Remove!"
    Else
        grid1.RowDefinitions.RemoveAt(0)
    End If
End Sub

若要檢視完整的範例,請參閱 如何:使用 ColumnDefinitionsCollections 和 RowDefinitionsCollections 運算元據行和資料列

備註

RowDefinitionCollection 使用以零起始的索引系統。

適用於

另請參閱