Forum Xamarin Cross Platform with Xamarin

Global Variables in MVVM Cross

Hi all,

We are developing MVVM cross application that supports WP,Droid and Touch. After successful Log-in we need to save some data's for accessing in whole application.

How to define global variables and access in application ? Kindly suggest

Posts

  • CheesebaronCheesebaron DKInsider, University mod

    Kindly research the topic before you post, there are a lot of resources on the Internet describing this. But there are a couple of ways I can think of you can do this.

    1. Create a service, with properties which hold your values. Remember services are singletons!
    2. Use the File plugin and serialize and deserialize an object which holds your values when needed.
    3. Use a Settings[1][2] plugin.
    4. Have a static file somewhere where you save stuff, similar to what the service actually does.
  • KathirVelKathirVel USMember ✭✭

    Yes you're right. i have tried the following methods mentioned in the links, but didnt work.
    Navigation Service , Twitter Search.

    We have tried for global declaration in last two to three days, but still couldn't find the solution.
    Thanks a lot for the answer.

  • JosRibeiroJosRibeiro USMember

    I'm with the same problem! In WP was easy setting variables in APP file and acssess they in any area of the app, but in Monodroid don't work!!!

Sign In or Register to comment.