I have two xamDataGrids one with Persons and one with Jobs and I'm using DataContext to bind to ObservableCollections Persons and Jobs (every person has a list with jobs). Here are my bindings:
DataSource="{Binding Path=Persons}"
DataSource="{Binding Path=Persons/Jobs}"
The problem I have is if I select a person in first grid it doesn't show the related jobs in the second grid, not even when using :
IsSynchronizedWithCurrentItem="True" .
Any ideas ?
In order for the IsSynchronizedWithCurrentItem property to work, you need to use a wrapper around your Persons object that implements ICollectionView.
This would work if you create a CollectionView from the Persons object like this:
ObservableCollection<Person> people = new ObservableCollection<Person>();CollectionView wrapper = new CollectionView(people);layout.DataContext = wrapper;
Let me know if you have any questions on this.