I am using a DataGridControl with the ItemSource bound to a DataGridCollectionViewSource. When I change the DataGridCollectionViewSource.ItemsSource I would like to reselect a specific Row if it still resides in the Grid.
My code looks like this:
// Rerun last query to get changes
// Get Grid to rebind
DataGridCollectionView viewSource = (DataGridCollectionView)ipIssueGrid.ItemsSource;
// Select Added Issue
foreach (IpIssueQuery ipQuery in ipIssueGrid.Items)
if (ipQuery.IpIssue.IpIssueId == ipIssueToAdd.IpIssueId)
ipIssueGrid.CurrentItem = ipQuery;
ipIssueGrid.SelectedItem = ipQuery;
I see that the DataGridCollectionViewSource has seen my OnPropertyChanged() event for the ItemSource and has called my Get Property before I set my CurrentItem and SelectedItem but it looks like the Grid hasn't really rebuilt it's ItemSource and I end up with the 1st row in the grid always selected.