• Stars
    star
    127
  • Rank 281,561 (Top 6 %)
  • Language
    C#
  • License
    MIT License
  • Created over 3 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple and lightweight page resolver for use in .NET MAUI projects

NuGet Status Nuget

Watch the video:

Watch the video

MAUI PageResolver

A simple and lightweight page resolver for use in .NET MAUI projects.

If you want a simple page resolver with DI without using a full MVVM framework (or if you want to use MVU), this package will let you navigate to fully resolved pages, with view models and dependencies, by calling:

await Navigation.PushAsync<MyPage>();

Advanced features

Additional features supported by PageReolver:

  • Paramaterised navigation - pass page parameters
await Navigation.PushAsync<MyPage>(myPageParam1, "bob", 4);
  • Paramaterised navigation - pass ViewModel parameters (.NET 8 version only)
await Navigation.PushAsync<MyPage>(myViewModelParam1, "bob", 4);
  • Source generator - automatically register dependencies in IServiceCollection with generated code (.NET 8 version only)
using Maui.Plugins.PageResolver;
using DemoProject;
using DemoProject.Pages;
using DemoProject.ViewModels;
using DemoProject.Services;
// ---------------
// <auto-generated>
//   Generated by the MauiPageResolver Auto-registration module.
//   https://github.com/matt-goldman/Maui.Plugins.PageResolver
// </auto-generated>
// ---------------

namespace DemoProject;

public static class PageResolverExtensions
{

    public static MauiAppBuilder UseAutodependencies(this MauiAppBuilder builder)
    {
         var ViewModelMappings = new Dictionary<Type, Type>();

         // pages
         builder.Services.AddTransient<MainPage>();


         // ViewModels
         builder.Services.AddTransient<MainViewModel>();


         // Services
         builder.Services.AddSingleton<IDefaultScopedService, DefaultScopedService>();
         builder.Services.AddTransient<ICustomScopedService, CustomScopedService>();


         // ViewModel to Page mappings
         ViewModelMappings.Add(typeof(MainPage), typeof(MainViewModel));


         // Initialisation
         builder.Services.UsePageResolver(ViewModelMappings);
         return builder;
    }
}
  • Lifetime attributes - override convention-based service lifetimes (singleton for services, transient for pages and ViewModels) in the source generator (.NET 8 version only)
[Transient]
public class CustomScopedService : ICustomScopedService
{
[...]

Getting Started

Check out the full instructions in the wiki on using PageResolver

More Repositories

1

MauiCleanTodos

Clean Architecture with ASP.NET Core, .NET MAUI and Blazor
C#
68
star
2

maui-chat

A simple chat app using SignalR, MAUI and Blazor
C#
39
star
3

outlook

Clone of the Microsoft Outlook mobile UI in .NET MAUI
C#
19
star
4

MauiB2C-No-MSAL

Azure AD B2C Authentication in .NET MAUI without MSAL
C#
7
star
5

CloudyMobile

Full stack .NET solution using .NET MAUI, ASP.NET and Blazor
SCSS
7
star
6

MauiMaterialEntry

Demonstrates create a Material style text input in .NET MAUI
C#
7
star
7

Maui.PasswordMeter

A simple password strength meter control for .NET MAUI
C#
6
star
8

CatMatch

A simple memory game, with cats
C#
6
star
9

VisitorGraph

Visitor registration and notification app using Microsoft Graph
C#
5
star
10

dotnetflix

Code demo repo for my Beyond Passwords talk
C#
5
star
11

ParallaxCollection

Demo showing parallax scrolling in .NET MAUI apps
C#
4
star
12

access-granted

TypeScript
4
star
13

ReactiveMaui

Reactive extensions with MVVM the easy way
C#
4
star
14

IconButton

C#
4
star
15

KillTeams

A PowerShell script that sets up a scheduled task that automatically kills MS Teams at 6pm every day
PowerShell
3
star
16

local-signin-with-apple

A script to enable local development for Sign-In with Apple
PowerShell
3
star
17

HotStepper

A custom stepper for Xamarin Forms with round +/- buttons and a value displayed in between them.
C#
3
star
18

matt-goldman.github.io

GoForGoldman Blog
HTML
1
star
19

MCT-popup-issue-demo

C#
1
star
20

PassthroughBehaviorDemo

Sample project showing how to pass through attached behaviors from a wrapper control to an inner control
C#
1
star
21

Goldie.BlankMauiTemplate

The default .NET MAUI template but without Shell
C#
1
star
22

MauiBatmobile

Demo of Microsoft.Maui.Graphics with gRPC in .NET MAUI
C#
1
star
23

EventAppDesignChallenge

C#
1
star
24

hello-github-actions

Dockerfile
1
star
25

SQLiteTest

A test app to troubleshoot an issue with EntityFrameworkCore with SQLite
C#
1
star
26

ios-modal-title-bug

Demonstrates an issue in .NET MAUI apps on iOS with page titles not displayed after pushing a modal page
C#
1
star
27

ResourceDictionaryWithDI

Demonstrates the workaround for DynamicResource when using resource dictionaries with DI
C#
1
star
28

LocationPermissionsTest

C#
1
star
29

ModalThemeBug

Demonstrates an issue with Shell BackgroundColor when pushing a modal page at startup
C#
1
star
30

brewjournal

An electronic journal for recording your home brew recipes, batches and results
C#
1
star
31

NavigationQueryTest

C#
1
star