© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
114 replies
Denis

✅ Correct MVVM approach for displaying models representing settings

Given that I have a set of models representing settings,
When I supply then to a UI utilizing MVVM,
And display each settings with a respective UI component,
Then the user can change the given setting
And the change will be reflected in the model.

As far as I've understood, Models shouldn't really be reactive, i.e., shouldn't implement the
INotifyPropertyChanged
INotifyPropertyChanged
interface.
This goes inline with the motive to keep models very simple, containing primarily properties.

Assume that I have generic models representing, e.g., a Toggle, Text input, Number input, and a Date input settings.
They share the same interface
ISettingsElement
ISettingsElement
, and are exposed to the View via the respective ViewModel.
Displaying specific UI elements based on the provided model is pretty easy.
But how do I make sure that the model values are two-way-bound to the UI elements?

E.g., I wish to display my collection of settings, and provide the user with a
Clear
Clear
or
Defaults
Defaults
button.
The ViewModel would naturally expose respective
ICommand
ICommand
implementations to do exactly that.
But... going through the Models and modifying their configured values won't be reflected in the UI.

Or, is there a non-hacky way to tell the parent UI control to refresh itself?

All this seems a bit hacky and limiting, when trying to do clean MVVM...
Hopefully, you'll be able to provide me the missing puzzle piece for correctly understading MVVM and implementing the settings feature.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Next page

Similar Threads

✅ MVVM: Are models observable?
C#CC# / help
3y ago
✅ WPF - how to approach a treeview displaying different types at different levels via MVVM
C#CC# / help
2y ago
MVVM - View model with collection of view models?
C#CC# / help
3y ago
Is my unit testing approach correct?
C#CC# / help
2y ago