Posted 7 August 2017, 4:12 pm EST
Hi,
My DataGrid is bound to a DataTable and after a column sort in the DataGrid is performed it returns the wrong ROW index, so the mapping between the model and the view are inconsistent, ( am i missing something ? )
I Access the row like this:
1. Setup grid and bind it to a dynamic data source
DataGrid myGrid = new DataGrid();
DataTable myGridData = new DataTable();
// add columns to table
// add new row(s) data to table
// bind grid to model
myGrid.ItemsSource = myGridData;
2. Get the current row the user clicked on
iRow = myGrid.CurrentRow.Index; ( or should i use display Index)
3. then i go to the model to get the data from it
string id = myGridData.Rows[. iRow ] [ "COL_ID"];
// this returns the wrong index !
Please help Nick