Search code examples
xamarinmvvmcross

Mvx does not exist in the current context


using MvvmCross.Platform.IoC;
using Acr.UserDialogs;


namespace YourMom.Core
{
    public class App : MvvmCross.Core.ViewModels.MvxApplication
    {
        public override void Initialize()
        {
            CreatableTypes()
                .EndingWith("Service")
                .AsInterfaces()
                .RegisterAsLazySingleton();

            Mvx.RegisterSingleton<IUserDialogs>(() => UserDialogs.Instance);

            RegisterAppStart<ViewModels.FirstViewModel>();
        }
    }
}

I try to use use dialog plugin for Xamarin mvvmcross. It says to put the registerSingleton code in my PCL app.cs, but i have error saying Mvx is not recognized. I am pretty sure i need to "using" some package i just don't know what. Pls help.


Solution

  • Guess I'm answering my own question yet again.

    The one to "import" is MvvmCross.Platform;

    So to solve this issue, just add

    using MvvmCross.Platform;
    

    To the top of App.cs.