-
Since MAUI (or maybe even before?) we can inject dependencies in our view constructor. From: containerRegistry.RegisterForNavigation<View, ViewModel>(); To: containerRegistry.Register<ViewModel>();
containerRegistry.RegisterForNavigation<View>(); and: class View {
public View(ViewModel vm)
{
BindingContext = vm;
}
} Of course it would be the view responsibility to set the Would it break something with Prism? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
So a couple of things...
|
Beta Was this translation helpful? Give feedback.
So a couple of things...
RegisterForNavigation
actually does register the ViewModel in Prism.Maui so there is no need to do it yourself. Also it should only be registered as a transient.RegisterForNavigation<ViewA, SomeViewModel>()
andRegisterForNavigation<ViewA, OtherViewModel>("ViewA1")
.