I am trying to implement a Master detail view in WPF MVVM.
In my viewmodel I have a observable collection of “Causes”. Each Cause has an observable collection of “Solutions”.
I bound an editable Datagrid to the Causes and it is working fine. But when a user selects a row in the DataGrid I want to allow the user to see its associated solutions in the TabControl.
How should I go about doing this? Should I create a property CurrentCause in the Viewmodel and bind it to the SelectedItem. In the TabControl can I bind to CurrentCause.Solutions.
Will this be an optimal approach? Please advise. Thanks!!
You could bind the
ItemsSourceof the TabControl to be theSelectedItemof the DataGrid using element binding.