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?
You can use DataGrid.Items.Count to get the number if items.
store the count in a variable
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...