Skip to content

BionicCodeStackoverflow/mvvm-open-file-dialog-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MVVM-Open-FileDialog-Example

BC BC BC BC
BC

Example relates to the Stackoverflow answer Open File Dialog MVVM

This examples shows ways how to open a file dialog or dialogs in general and how to handle the result in an MVVM conform manner.

Each solution is hosted in a separate directory.

Solution 1:
Very simple and basic scenario, that uses code-behind view model method calls in order to pass on the dialog data and execute the persistence operation in the model.

Solution 2:
Solution that uses data binding to sende the dialog data to the view model and execute the persistence operation in the model.

Solution 3:
Another, more elegant solution that builds on solution #2 and uses data validation in the view model (GitHub: Data_Validation_Example, Stackoverflow: How to add validation to view model properties or how to implement INotifyDataErrorInfo) and an ICommand to send the dialog result to the view model and execute the persistence operation in the model.

Solution #4:
Shows how the view model or model can open a dialog in view by using a messaging infracstructure based on the Event Aggregator design pattern. Note, although this solution does not require the view model or model to reference any dialog related types (e.g., a "dialog service") and is a simply event based solution, it still violates against the MVVM design rules (component responsibilities) and should be avoided.
Read the Important_Note.txt document for further explanations.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages