// private ObservableDictionary defaultViewModel = new ObservableDictionary(); // private readonly ResourceLoader resourceLoader = ResourceLoader.GetForCurrentView("Resources"); public StartScreen() { this.InitializeComponent(); this.navigationHelper = new NavigationHelper(this); this.navigationHelper.LoadState += this.NavigationHelper_LoadState; this.navigationHelper.SaveState += this.NavigationHelper_SaveState; vm = ViewModel.returnMyViewModel(); }
public ItemPage() { this.InitializeComponent(); this.navigationHelper = new NavigationHelper(this); this.navigationHelper.LoadState += this.NavigationHelper_LoadState; this.navigationHelper.SaveState += this.NavigationHelper_SaveState; vm = ViewModel.returnMyViewModel(); //creating an instance of ViewModel this.DataContext = vm; // for data binding }
public PivotPage() { this.InitializeComponent(); this.NavigationCacheMode = NavigationCacheMode.Required; this.navigationHelper = new NavigationHelper(this); this.navigationHelper.LoadState += this.NavigationHelper_LoadState; this.navigationHelper.SaveState += this.NavigationHelper_SaveState; vm = ViewModel.returnMyViewModel(); this.DataContext=vm; }
public static ViewModel returnMyViewModel() { return myViewModel ?? (myViewModel = new ViewModel()); // singleton }