How can I use LocalSettings (UWP) in my ViewModel class?

61 Views Asked by At

So I want to use LocalSettings (for UWP) inside my ViewModel class (so that I can persist data between views) but I keep getting this error in this screenshot: enter image description here

However, I try to add a reference to the assembly but nothing happens.

My ViewModel inherits from ViewModelBase (Common logic among all view models)

MyViewModel : ViewModelBase 

Where ViewModelBase : INotifyPropertyChanged, ILoadableViewModel, IVisibilityAwareViewModel

What can I do to persist data between viewmodels in this scenario? I have a property in one of my viewmodels that I want to use in another viewmodel and that's where the issue lies.

1

There are 1 best solutions below

2
Miguel Angel Muñoz On

You can't use LocalSettings in PortableClassLibrary (PLC) .

When i need save data i use this plugin https://github.com/jamesmontemagno/SettingsPlugin . It's a great plugin . You should try it.