Forum Xamarin.Android


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Moving data between viewmodels MVVMCross


I'm newbie in Xamarin and MVVMCross.

My app shows list of cars using MvxRecyclerView and I want to show full specification of selected car in new view. I did a navigation in my CarViewModel to CarItemViewModel but I have no idea how to pass object of selected car from my MVXRecyclerView to new view. I know how to solve this problem using "raw" C# and Android background but I should do it using MVVMCross mechanics (unfortunately, MVVMCross documentation is not helpful).

I would appreciate for any help.


  • smhasansmhasan KWMember ✭✭✭
    edited January 11

    There are 2 way to pass data in MVVM model
    1. Message Center ([])
    2. Second you can use AppPreferences Class like below

    public static class AppPreferences
    #region SetLanguage
    public static void SetLanguage(string key, string value) { Preferences.Set(key, value); }
    public static string GetLanguage(string key) { return Preferences.Get(key, ""); }

        #region all data in json
        public static void SetJson(string key, string value) {Preferences.Set(key, value);}
        public static string GetJson(string key){return Preferences.Get(key, "");}

    Use class where you want with Get and Set and proper key

Sign In or Register to comment.