I'm trying to learn the MVVM model by creating an UWP project. From what I've gathered, ViewModel is supposed to be independent from the actual View (portable?). I just want to clarify if what I understand is right.
Say I have a SplitView
:
<Grid>
...
<Button Click="ActivateRelativePanel Content="CLICK!"/>
<SplitView>
<SplitView.Pane>
...
</SplitView.Pane>
<SplitView.Content>
<Frame Name="MyFrame"/>
</SplitView.Content>
</SplitView>
</Grid>
Is it right to change the Open/Closed status (SandwitchSplitMenu.IsPaneOpen = !SandwitchSplitMenu.IsPaneOpen;
) of the SplitView
in VM or xaml.cs, since this is a view specific thing? From what I understand so far, this should be inside a xaml.cs file, since it's a view specific thing, but a friend of mine told me that I should use xaml.cs file as less as possible when relying on MVVM.
While I'm at it, should the Frame be Navigated (MyFrame.Navigate(typeof(SomePage));
) through the VM or xaml.cs? The frame is also a view-specific thing.
I know that loaded data from the models should be done by binding, through VM, but I'm interested as to what is supposed to be inside a VM and what is supposed to be inside a xaml.cs file.
Also, any other good UWP MVVM tutorial guide or anything is more than welcome!