What is the best way to bind WPF properties to ApplicationSettings in C#? Is there an automatic way like in a Windows Forms Application? Similar to this question, how (and
You can directly bind to the static object created by Visual Studio.
In your windows declaration add:
xmlns:p="clr-namespace:UserSettings.Properties"
where UserSettings
is the application namespace.
Then you can add a binding to the correct setting:
Now you can save the settings, per example when you close your application:
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
Properties.Settings.Default.Save();
base.OnClosing(e);
}