-
This probably is going to be a banal question, but I was not able to find any tutorial addressing this issue and I'm not able to figure it out myself. I'm migrating my Xamarin.Forms app to MAUI. The time to migrate the dependency services has arrived. Here is a little sample: Definition & implementations of my class
My MAUI program now, looks like this:
This is my PrismStartup page looking like:
Finally, this is how I'm requesting my IApplicationVersion from my viewModel:
But my LoginPage view model constructor it's always called before builder.Build();, so, even requesting IApplicationVersion from its constructor, I only receive a null instance. What I'm doing wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
private static void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.RegisterForNavigation<LoginPage, LoginPageViewModel>()
.RegisterInstance(SemanticScreenReader.Default);
containerRegistry.RegisterForNavigation<MainPage, MainPageViewModel>()
.RegisterInstance(SemanticScreenReader.Default);
} One thing to note you don't need to be calling Without a reproduction it's hard to say what's happening but there is nothing that Prism is doing that would should cause the LoginPageViewModel to be resolved before the |
Beta Was this translation helpful? Give feedback.
One thing to note you don't need to be calling
.RegisterInstance(SemanticScreenReader.Default);
after each time you register a page.Without a reproduction it's hard to say what's happening but there is nothing that Prism is doing that would should cause the LoginPageViewModel to be resolved before the
.Build()
is called.