Properties.Settings.Default.Default.Save() does not work
- by Akshay
I have created code in WPF to let the window remember its last location like this:
private void Window_Loaded(object sender, RoutedEventArgs e)
{
try
{
Rect storedLoc = Properties.Settings.Default.WindowSavedLocation;
this.Top = storedLoc.Top;
this.Left = storedLoc.Left;
}
catch
{
MessageBox.Show("No settings stored !");
}
}
private void Window_Closed(object sender, EventArgs e)
{
Properties.Settings.Default.WindowSavedLocation = RestoreBounds;
Properties.Settings.Default.Save();
}
When I build the application I can see that the app.exe.config file has the setting
WindowSavedLocation
but it just does not save and throws no exception.
Everytime I run the application, it says "No settings stored !".
It's scope is user.