I'm using Galasoft MVVM Light Framework.
What I want to achieve is this:
All my viewmodels are statically declared as instance fields in my MainViewModel.cs so they maintain state when swiching between windows:
#region Viewmodels init.
readonly static InputViewModel _inputViewModel = new InputViewModel();
[...]
readonly static LicensesViewModel _licensesViewModel = new LicensesViewModel();
readonly static PricesViewModel _pricesViewModel = new PricesViewModel();
#endregion
In my input user control i'm displaying a tabcontrol. In each tabitem i'm binding a new usercontrol as view
<UserControl>
<DockPanel>
<TabControl>
<TabItem Header="Prices">
<local:PricesControl DataContext="{x:Type viewModels:PricesViewModel}" />
</TabItem>
<TabItem Header="Licenses">
<local:LicenseControl DataContext="{x:Type viewModels:LicensesViewModel}" />
</TabItem>
</TabControl>
</DockPanel>
</UserControl>
I'm however unable to bind the viewmodel to the view. The tabcontrol is always in the datacontext of the inputviewmodel.
Any suggestions are greatly appreciated!