Quantcast
Viewing all articles
Browse latest Browse all 18858

ObservableCollection replace item SelectedIndex bug when bound to DataGrid

It seems that when an item in an ObservableCollection is replaced, the SelectedIndex of the bound DataGrid is set to -1.

//Here SelectedIndex is 4

obColl[4] = newItem;

//Here SelectedIndex is -1


Someone else had the same issue as below:

http://social.msdn.microsoft.com/Forums/vstudio/en-US/024730d9-ea79-4231-a006-2f901c61f546

Tried a workaround by explicitly re-selecting the new replacement item in the DataGrid. However, this is causing some nasty side-effects like DataGrid is selecting multiple items after replacement. Any inputs appreciated!


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>