If I had to do a sum of a specific columns of selected rows in a DataGridView, I would usually do something like
decimal total = myDGV.SelectedRows.OfType<DataGridViewRow>()
.Sum(t => Convert.ToDecimal(t.Cells[2].Value));
How do I do that in WPF?
If I did:
decimal total = myGrid.SelectedItems.OfType<DataGridRow>()
.Sum(t => Convert.ToDecimal(t.Cells[2].Value));
I get an error 'System.Windows.Controls.DataGridRow' does not contain a definition for 'Cells' and no extension method 'Cells' accepting a first argument of type 'System.Windows.Controls.DataGridRow' could be found (are you missing a using directive or an assembly reference?) (CS1061)
Help please.