I have the following model:
public class Model : INotifyPropertyChanged { public ObservableCollection<ViewElement> Elements { get; set; } public ViewElement CurrentElement { get; set; } }
And the following grid where the parent DataContext is the above model:
<dg:XamDataGrid DataSource='{Binding Path=Elements}' />
I want to bind the CurrentElement property to the Selected Item of the Grid, similar to how I would in a ListView:
<ListView x:Name='playbackSteps' ItemsSource='{Binding Path=Elements}' SelectedItem='{Binding Path=CurrentElement}' />
How would you suggest I do this?
As stated on the Infragistics forum, the XamDataGrid exposes an IsSynchronizedWithCurrentItem property. To take advantage of this, you need a ListCollectionView of your ObservableCollection. Something like this:
Then bind your XamDataGrid to ElementsView.