Click here to Skip to main content
15,887,485 members
Home / Discussions / WPF
   

WPF

 
QuestionMVVM FolderBrowserDialog Pin
eddieangel15-Nov-10 13:23
eddieangel15-Nov-10 13:23 
AnswerRe: MVVM FolderBrowserDialog Pin
SledgeHammer0115-Nov-10 13:32
SledgeHammer0115-Nov-10 13:32 
GeneralRe: MVVM FolderBrowserDialog Pin
eddieangel15-Nov-10 13:59
eddieangel15-Nov-10 13:59 
GeneralRe: MVVM FolderBrowserDialog Pin
SledgeHammer0115-Nov-10 14:47
SledgeHammer0115-Nov-10 14:47 
GeneralRe: MVVM FolderBrowserDialog Pin
eddieangel16-Nov-10 6:10
eddieangel16-Nov-10 6:10 
AnswerRe: MVVM FolderBrowserDialog Pin
Abhinav S16-Nov-10 4:54
Abhinav S16-Nov-10 4:54 
GeneralRe: MVVM FolderBrowserDialog Pin
eddieangel16-Nov-10 6:05
eddieangel16-Nov-10 6:05 
GeneralRe: MVVM FolderBrowserDialog Pin
SledgeHammer0116-Nov-10 7:04
SledgeHammer0116-Nov-10 7:04 
In my previous response, I gave you an example of why ServiceLocator is "good" as it relates to the folder browser dialog. The link that Abhinav gave you is a bit over engineered and generalized IMO. ServiceLocator is not MVVM. MVVM is the architecture pattern and ServiceLocator is one of the design patterns used to support it. To do MVVM "the right way", you'd need ServiceLocator, a dialog service and an event aggregator service. Some people will use a mediator pattern instead of event aggregator, but I wouldn't. EventAggregator is just as easy (if not easier) to implement and its more loosely coupled and more general.

Once you get past all the pretentious buzz words, all this stuff is pretty basic when implemented in a generic way.

ServiceLocator is just a map of service type -> service instance
EventAggregator is just a map of message type -> subscribers

* unit testability is one reason for MVVM
* expression blend support is another
* you could theoretically have a graphics designer do the eye candy aspect without having to touch the code (theoretically)
* its easier to completely swap views out for something else

Honestly, as I mentioned before, if you don't care about the 4 points above (and don't think that you ever will), why bother with MVVM? it does have an initial startup cost to get everything situated and understand the concepts. BUT, if your infrastructure is well designed in a generic reusable package, that start up cost is one time and can be reused in all future MVVM projects.

Another quick example... if you are used to the Winforms way, your window code are probably very closely coupled to the data structures and control types. If your first pass is a linked list tied to a list control, you probably have all the linked list stuff intermingled with list control stuff. What if you want to change one or both to something else? That'd be a hassle without MVVM, but with MVVM, it would be a lot easier.
GeneralRe: MVVM FolderBrowserDialog Pin
eddieangel16-Nov-10 7:11
eddieangel16-Nov-10 7:11 
GeneralRe: MVVM FolderBrowserDialog Pin
SledgeHammer0116-Nov-10 9:09
SledgeHammer0116-Nov-10 9:09 
AnswerRe: MVVM FolderBrowserDialog Pin
Kevin Marois17-Nov-10 5:24
professionalKevin Marois17-Nov-10 5:24 
GeneralRe: MVVM FolderBrowserDialog Pin
SledgeHammer0117-Nov-10 9:47
SledgeHammer0117-Nov-10 9:47 
GeneralRe: MVVM FolderBrowserDialog Pin
Kevin Marois17-Nov-10 11:14
professionalKevin Marois17-Nov-10 11:14 
GeneralRe: MVVM FolderBrowserDialog Pin
SledgeHammer0117-Nov-10 12:31
SledgeHammer0117-Nov-10 12:31 
GeneralRe: MVVM FolderBrowserDialog Pin
Pete O'Hanlon17-Nov-10 10:00
mvePete O'Hanlon17-Nov-10 10:00 
GeneralRe: MVVM FolderBrowserDialog Pin
_Maxxx_17-Nov-10 16:11
professional_Maxxx_17-Nov-10 16:11 
GeneralRe: MVVM FolderBrowserDialog Pin
Pete O'Hanlon17-Nov-10 21:50
mvePete O'Hanlon17-Nov-10 21:50 
QuestionDataGrid - merging cells Pin
urinspiration15-Nov-10 7:41
urinspiration15-Nov-10 7:41 
QuestionWPF Style Question Pin
Kevin Marois15-Nov-10 7:08
professionalKevin Marois15-Nov-10 7:08 
AnswerRe: WPF Style Question Pin
#realJSOP15-Nov-10 8:03
mve#realJSOP15-Nov-10 8:03 
GeneralRe: WPF Style Question Pin
Kevin Marois15-Nov-10 8:05
professionalKevin Marois15-Nov-10 8:05 
GeneralRe: WPF Style Question [modified] Pin
SledgeHammer0115-Nov-10 8:55
SledgeHammer0115-Nov-10 8:55 
GeneralRe: WPF Style Question Pin
Kevin Marois15-Nov-10 12:13
professionalKevin Marois15-Nov-10 12:13 
GeneralRe: WPF Style Question Pin
SledgeHammer0115-Nov-10 13:29
SledgeHammer0115-Nov-10 13:29 
GeneralRe: WPF Style Question Pin
Kevin Marois16-Nov-10 4:37
professionalKevin Marois16-Nov-10 4:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.