Windows-XAML/Template10

ViewModel for ShellPage?

Nexxkinn opened this issue · 2 comments

I saw the implementation in App.xaml.cs that the Page is not registered with a viewmodel. Is there a way to register the shell with a viewmodel in that case?

Just to be clear, It's possible(?) with ViewModelLocator.AutowireViewModel="True" but the upcoming Prism.Windows 7.1.0 somehow include nullable type, which is a no no in XAML.
image

Interesting. Let me think about this. I am working on it now.

Nope. I don't see why this would be necessary.

var shell = new ShellPage {  DataContext = new ShellViewModel() } ;

Or with injection

var shell = Resolve<ShellPage>();
shell.DataContext = Resolve<ShellViewModel>();

Not sure why any of the navigation methods would be necessary. But if they are, call 'em:

(shell.DataContext as ShellViewModel).OnNavigatedTo(null);