mvvm-dialogs | Library simplifying the concept of opening dialogs
kandi X-RAY | mvvm-dialogs Summary
kandi X-RAY | mvvm-dialogs Summary
MVVM Dialogs is a library simplifying the concept of opening dialogs from a view model when using MVVM in WPF (Windows Presentation Framework) or UWP (Universal Windows Platform). It enables the developer to easily write unit tests for view models in the same manner unit tests are written for other classes.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of mvvm-dialogs
mvvm-dialogs Key Features
mvvm-dialogs Examples and Code Snippets
Community Discussions
Trending Discussions on mvvm-dialogs
QUESTION
When I asked about how to implement a dialog in MVVM someone advised me to read this thread:
MVVM, DialogService and Dialog Result
In the view model, the dialog is called in this way:
...ANSWER
Answered 2017-Jul-30 at 07:51The basic idea of the MVVM pattern is the separation of concerns. The View Model should not know how to handle or present a dialog. Why? Here are some reasons:
- Testing your View Model: No dialogs are desired (Imagine you need to click dialogs all the time)
- Creating a console application of a GUI application (The dialogs should be shown in console not as popup boxes)
- It is required to change the design of your dialogs (Imagine you need to change all MessageBox calls)
- ...
Solution: Using dependency injection by implementing a well defined interface for dialogs. You can find a very good and basic example in in this answer.
Result:
Calling _dialogservice.ShowDialog
is maybe only a wrapper of MessageBox.Show
but could also be a some dialog in a console in a console application or debug log during testing. So the code is well separated of any presentation.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install mvvm-dialogs
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page