RowDefinitionCollection.Count 屬性

定義

取得這個 RowDefinitionCollection 執行個體內的項目總數。

public:
 property int Count { int get(); };
public int Count { get; }
member this.Count : int
Public ReadOnly Property Count As Integer

屬性值

Int32

集合中的項目總數。 此屬性沒有預設值。

實作

範例

下列範例示範如何使用 Count 屬性。

private void rowCount(object sender, RoutedEventArgs e)
{
    tp2.Text = "The current number of Rows is: " + grid1.RowDefinitions.Count;
}
Private Sub rowCount(ByVal sender As Object, ByVal e As RoutedEventArgs)
    tp2.Text = "The current number of Rows is: " + grid1.RowDefinitions.Count.ToString()
End Sub

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

備註

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

適用於

另請參閱