RowDefinitionCollection.Count 屬性

定義

取得這個 RowDefinitionCollection 執行個體內的項目總數。Gets the total number of items within this instance of RowDefinitionCollection.

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

屬性值

集合中的項目總數。The total number of items in the collection. 此屬性沒有預設值。This property has no default value.

實作

範例

下列範例示範如何使用Count屬性。The following example demonstrates how to use the Count property.

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 管理資料運算元據行和資料列。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.

適用於

另請參閱