RowDefinitionCollection.RemoveRange(Int32, Int32) 方法

定义

从一个 RowDefinitionCollection. 中删除一系列RowDefinition对象。

public:
 void RemoveRange(int index, int count);
public void RemoveRange(int index, int count);
member this.RemoveRange : int * int -> unit
Public Sub RemoveRange (index As Integer, count As Integer)

参数

index
Int32

移除第一个 RowDefinition 集合中的位置。

count
Int32

要从集合中移除的对象 RowDefinition 总数。

示例

下面的示例演示如何使用RemoveRange该方法从一RowDefinitionCollection个元素中删除一系列RowDefinition元素。

private void rem5Row(object sender, RoutedEventArgs e)
{
    if (grid1.RowDefinitions.Count < 5)
    {
        tp1.Text = "There aren't five Rows to Remove!";
    }
    else
    {
        grid1.RowDefinitions.RemoveRange(0, 5);
    }
}
Private Sub rem5Row(ByVal sender As Object, ByVal e As RoutedEventArgs)
    If (grid1.RowDefinitions.Count < 5) Then
        tp1.Text = "There aren't five Rows to Remove!"
    Else
        grid1.RowDefinitions.RemoveRange(0, 5)
    End If
End Sub

若要查看完整的示例,请参阅 如何:使用 ColumnDefinitionsCollections 和 RowDefinitionsCollections 操作列和行

注解

RowDefinitionCollection 使用从零开始的索引系统。

适用于

另请参阅