A small, yet powerful framework, designed for building applications across all XAML platforms. Its strong support for MV* patterns will enable you to build your solution quickly, without the need to sacrifice code quality or testability.
Hi I'm having trouble working out how to use the INavigationService in MAUI. In Xamarin Forms we used to override PrepareViewFirst to inject the NavigationPageAdapter object into the container. In MAUI though PrepareViewFirst is never called when using DisplayRootViewForAsync.
Here's what I've got
public App()
{
InitializeComponent();
Initialize();
_container = container;
_container.PerRequest<HomeViewModel>();
_container.PerRequest<AnotherViewModel>();
DisplayRootViewForAsync<HomeViewModel>();
}
// This is never called so no NavigationService will get added to the container
protected override void PrepareViewFirst(NavigationPage navigationPage)
{
_container.Instance<INavigationService>(new NavigationPageAdapter(navigationPage));
}
From looking at the source code I tried calling PrepareViewFirst() before DisplayRootViewForAsync and that successfully added a NavigationPageAdapter to the container however when INavigationService is injected into a viewmodel calling NavigateToViewModelAsync does nothing.
Hi I'm having trouble working out how to use the
INavigationService
in MAUI. In Xamarin Forms we used to overridePrepareViewFirst
to inject theNavigationPageAdapter
object into the container. In MAUI thoughPrepareViewFirst
is never called when usingDisplayRootViewForAsync
.Here's what I've got
From looking at the source code I tried calling
PrepareViewFirst()
beforeDisplayRootViewForAsync
and that successfully added aNavigationPageAdapter
to the container however whenINavigationService
is injected into a viewmodel callingNavigateToViewModelAsync
does nothing.So how do we navigate between viewmodels in MAUI?
I'm using the latest beta version from MyGet