Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVVM WPF save and load user settings design pattern

Tags:

c#

.net

mvvm

wpf

I am looking for a good tutorial / explanation that shows where and how to implement settings in a MVVM WPF application. I understand .net has built-in support for settings but is this typically used for medium to larger size applications? What are the alternatives?

I am thinking of storing many user settings such as window size, grid column size, font size, font, etc...

Thank you for the help!

like image 596
dnndeveloper Avatar asked Sep 28 '10 00:09

dnndeveloper


People also ask

Is MVVM slow?

MVVM Done Right is Slow In a large application, you might need to loop through the data multiple times to make sure it has all recalculated correctly. If you just use the framework and let the framework deal with your sloppy code, this can make the system incredibly slow.

Is WPF MVVM or MVC?

MVVM is written for desktop application with data binding capabilities – XAML and the INotifyPropertyChanged interface. If you want to do modification in the View-Model, the View-Model uses an observer pattern. The MVVM pattern is mostly used by WPF, Silverlight, nRoute, etc.

What is INotifyPropertyChanged in WPF?

The INotifyPropertyChanged interface is used to notify clients, typically binding clients, that a property value has changed. For example, consider a Person object with a property called FirstName .


1 Answers

The built-in settings file is a good place to store common things like window size, theme, etc... (Stuff the user does not enter themselves... ambient state) but for more advanced settings that the user can customize, I would rather build my own... This gives me better control over how and where it gets stored! Also check out this article for an example of a medium sized MVVM app using the settings file!

like image 118
rudigrobler Avatar answered Oct 01 '22 02:10

rudigrobler