0

I developing an wpf application with MVVM Light and I have all my ViewModels and Models within a class library. Now I would like to change a user setting but dont have access to the settings of my UI-Project in the viewmodel of my class library.

Question: Do I have to implement the change of a user setting into my View(UI)-Project to get this to work or ist there a way I could do this in my class library?

the only object I could use there is the Application.Current.Properties but that dont seem to be the correct ones:

Application.Current.Properties["Design"] = s;

I know I have to use:

Settings.Default.Design = s;

and on Exit I need to save all my settings to make the change persistent:

Settings.Default.Save();

I've seen something here - that seems to be a similar issue but I dont understand the answers...

ASh
  • 34,632
  • 9
  • 60
  • 82

1 Answers1

0

I found an easy solution by myself. Just need to use the OnExit-Event (App.Xaml.cs):

    protected override void OnExit(ExitEventArgs e)
    {
        if (Settings.Default.Design != DesignName())
        {
            Settings.Default.Design = DesignName();
            Settings.Default.Save();
        }

    }