Skip to content

MAUI dependency services + Prism #3139

Answered by dansiegel
nk-alex asked this question in .NET MAUI
Discussion options

You must be logged in to vote
    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 .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.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@nk-alex
Comment options

Answer selected by nk-alex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants