I have a DataGrid with an item source as an observable collection. At button click on of the value in a column of the current row gets increased by 1. So I went to solve it this way;
ItemRow currentRow = (ItemRow)myDataGrid.SelectedItem; newQty = currentRow.qty + 1; newExtPrice = newQty * currentRow.price; myCollection.Remove(currentRow); myCollection.Add(new ItemRow { itemid = currentRow.itemid, qty = newQty });
The problem is that the DataGrid view order gets changed. So for example say there were 4 rows in the grid and the user clicks on the first row, that row is removed and placed at the bottom. What is the better way to handle this?