I'm structuring my WPF application using MVVM Light and am creating the ViewModel using the IOC.
The page initializes its DataContext like this:
DataContext="{Binding Main, Source={StaticResource Locator}}"
A TabControl has its content bound to another ViewModel, so binding from within the TabControl will access the tab ViewModel by default.
Now, how can I instead access the page ViewModel in XAML?
Before switching to use IOC, the ViewModel was created as a StaticResource and I could access it like this
Zoom="{Binding Zoom, Source={StaticResource ViewModel}, Mode=TwoWay}"
Then I could also access it via the Locator, however I don't like this syntax as what happens if this ViewModel instance was created with a key? I don't think the content binding should care about such details.
Zoom="{Binding Main.Zoom, Source={StaticResource Locator}, Mode=TwoWay}"
What's the right way of doing it?