Skip to content
Matt Goldman edited this page Mar 12, 2022 · 12 revisions

Welcome

Maui.Plugins.PageResolver is a super-lightweight package for .NET MAUI projects. It leverages the built-in DI container to resolve pages for you with all their dependencies, including ViewModels and services.

Using PageResolver, you can just use Navigation.PushAsync<MyPage>(); in your code, and the Resolver will push a fully resolved instance of MyPage onto the navigation stack.

The latest version supports parameters too. If you have a page with a non-default constructor you can pass the parameters it expects too, eg., Navigation.PushAsync<MyPage>(arg1, arg2, ...);. You don't need to include the ViewModel (or anything registered with the ServiceProvider) as this will be resolved for you.

Use the links on the right to explore the capabilities of the package.

FAQ

You say 'lightweight' a lot. How lightweight is it exactly?

Very. In fact, there are way more lines of text in this wiki than there are lines of code in the package. Unlike MVVM frameworks used in Xamarin.Forms, this package doesn't need to provide its own IoC container or DI implementation. .NET MAUI uses the generic hostbuilder pattern and includes DI out of the box, which PageResolver uses. Apart from Autoreg, PageResolver is just a collection of useful extension methods.

Does it work with Shell?

Yes it works with Shell! Shell resolves dependencies for you automatically, so you don't need PageResolver for regular navigation, but it's useful for the Autoreg feature and also when using modal pages.