My view model MyViewModel has a property MyProperty that i need to read/save from/to the application's settings. My project has Settings.settings file and the Settings type has MyProperty property. i need to bind MyViewModel.MyProperty to Settings.MyProperty so that any changes to MyViewModel.MyProperty are reflected in the Settings.MyProperty, and possibly the other way around. how can i do that?
note that i cannot derive MyViewModel from Settings because MyViewModel already derives another type.
EDIT: i can do it manually of course: read and write from and to Settings in my property definition, but i am asking whether there is a more elegant approach.
class MyViewModel : ViewModelBase
{
public int MyProperty { ... }
public MyViewModel()
{
// here i need to bind Settings.Default.MyProperty to this.MyProperty
}
}