ColumnDefinitionCollection.Count 屬性

定義

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

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

屬性值

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

實作

範例

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

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

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

適用於

另請參閱