Hi,
I'm using the grid to bind to an ICollectionView. I've added a behaviour on the grid so that it binds to the CurrentItem.When the CurrentItem changes, it will select the corresponding row and call ScrollIIntoView on it. Vice-versa selecting a row calls MoveCurrentTo() on the ICollectionView.
I've used that in some other part of the application and it works great. However, on this new grid I do the following operations (the grid uses TemplateColumns):
- _myCollectionView.Clear();
- var savedPosition = _myCollectionView.CurrentPosition;
- foreach(...) { _myCollectionView.Add(myObject); }
- _myCollectionView.MoveCurrentToPosition(savedPosition);
Unfortunately the current item is selected (the row is coloured), but it's not brought into view.
Now if I replace the last instruction by:
- SynchronizationContext.Current.Post((o) => _myCollectionView.MoveCurrentToPosition(savedPosition));
Then it brings the current item to view.
Am I doing something wrong or is this a bug of the grid?
PS: If I can I'll try to create a test project.
Cheers.
I tried to create a sample project showing the same issue but didn't manage to.
It may be because my objects are a bit more complex than the ones from my sample or because I'm using PRISM and I activate the view containing the grid just before updating its content.