Row Count for WPF DataGrid?

How to count or return the last index of a DataGrid row? Apparently there's isn't a DataGrid.Count() property. I searched everywhere and I can't find an answer. I could create a variable and do a i++ as a counter for Row count, but doesn't DataGrid has generic solution?

Answers


You can use DataGrid.Items.Count to get the number if items.


store the count in a variable

 int num=dataGrid.Items.Count

As TBohnen.jnr mentioned you should count the items in the bounded datasource. You can retrieve the datasource by casting dataGrid.DataContext to the appropriate Type (List, IEnumerable, or any other Type) and call .Count on that object. It shouldn't be very hard...


Need Your Help

C array vs NumPy array

python c arrays numpy cython

In terms of performance (algebraic operations, lookup, caching, etc.), is there a difference between C arrays (which can be exposed as a C array, or a cython.view.array [Cython array], or a memoryv...

format mysql timestamp using php

php mysql

i have column named postDate defined as timestamp.