I was trying to push a modal page in my xamarin forms app using MVVM when pressing a button. I already know how to use navigation stacks, but no idea how to do it with content pages as modal pages, I have tried multiple things, especially, calling the PushPageModel method.
This is the last thing I have tried: View or Page:
<Label
x:Name="forgottenPasswordLabel"
Text="Forgot password?"
TextColor="LightPink"
FontSize="16"
FontAttributes="Bold"
VerticalOptions="Start"
HorizontalOptions="End"
Margin="25,0,25,25">
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding ForgotPasswordCommand}"/>
</Label.GestureRecognizers>
</Label>
ViewModel class:
public class LogInViewModel : FreshBasePageModel
{
public ICommand ForgotPasswordCommand { get; set; }
public LogInViewModel()
{
}
public override void Init(object initData)
{
ForgotPasswordCommand = new Command (async() =>
{
var newPage = FreshPageModelResolver.ResolvePageModel<ForgottenPasswordViewModel>();
await CoreMethods.PushPageModel<ForgottenPasswordViewModel>(null, false, true);
});
}
}
App.xaml.cs class:
public App()
{
InitializeComponent();
MainPage = FreshPageModelResolver.ResolvePageModel<LogInViewModel>();
}
This code gives the following error: "FreshTinyIoC.TinyIoCResolutionException: 'Resolve failed: IFreshNavigationService"
And that is all, if you need more information I will provide it as soon as I see your request, thank you all for your time, hope you have a great day.
Edit: Stack trace requested:
at FreshTinyIoC.FreshTinyIoCContainer.ResolveInternal (FreshTinyIoC.FreshTinyIoCContainer+TypeRegistration registration, FreshTinyIoC.NamedParameterOverloads parameters, FreshTinyIoC.ResolveOptions options) [0x000f7] in C:"Here goes the path" at FreshTinyIoC.FreshTinyIoCContainer.Resolve (System.Type resolveType, System.String name) [0x00000] in C:\"Here goes the path" at FreshTinyIoC.FreshTinyIoCContainer.Resolve[ResolveType] (System.String name) [0x00000] in C:"Here goes the path" at FreshMvvm.FreshTinyIOCBuiltIn.Resolve[ResolveType] (System.String name) [0x00000] in C:"Here goes the path" at FreshMvvm.PageModelCoreMethods.PushPageModelWithPage (Xamarin.Forms.Page page, FreshMvvm.FreshBasePageModel pageModel, System.Object data, System.Boolean modal, System.Boolean animate) [0x00177] in C:"Here goes the path" at FreshMvvm.PageModelCoreMethods.PushPageModel (FreshMvvm.FreshBasePageModel pageModel, System.Object data, System.Boolean modal, System.Boolean animate) [0x00048] in C:"Here goes the path" at FreshMvvm.PageModelCoreMethods.PushPageModel[T] (System.Object data, System.Boolean modal, System.Boolean animate) [0x00040] in C:"Here goes the path" at FirstApp.ViewModels.LogInViewModel.b__5_0 () [0x0003a] in D:\"Here goes the path"