Position 8:13. StaticResource not found for key XFViewModelLocator

sumitsisodia.9614sumitsisodia.9614 USMember ✭✭
edited September 9 in Xamarin.Forms

i am navigate one page to another but i am getting this error some body help me where i am wrong.

this is my navigation xaml page

this is my ViewModel
public class HandleSoftwarePageViewModel : XFVNNavigationAnimationBasePageViewModel
{
public override void OnSoftBackButtonPressed()
{
try
{
var page = ((NavigationPage)Application.Current.MainPage).CurrentPage as HandleSoftwarePageView;

            page?.DisplayAlert("Ahihi",
                "This is hanlde software back button from ViewModel, do you want go to previous page", "OK", "Cancle");
        }
        catch (Exception ex) 
        {
        }
    }
}

and viewmodelLocator
public class XFViewModelLocator
{
public HandleHardwarePageViewModel HandleHardwarePageViewModel => new HandleHardwarePageViewModel();

    public HandleSoftwarePageViewModel HandleSoftwarePageViewModel => new HandleSoftwarePageViewModel();
}

Thanks For advance.

Posts

  • RyanDixonRyanDixon USMember ✭✭✭

    It looks like the error wouldn't be coming from that page. It might potentially lie in the base XFVNNavigationAnimationBasePageViewModel? You are trying to call some form of resourcedictionary to obtain the ViewModelLocator which is failing.

    Look for something like App.Resource["XFViewModelLocator"] or in XAML,

Sign In or Register to comment.