Click here to Skip to main content
15,899,314 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: WPF Dialog Service via Binding Pin
Adrian Alexander30-Jan-12 5:24
Adrian Alexander30-Jan-12 5:24 
GeneralRe: WPF Dialog Service via Binding Pin
SledgeHammer0130-Jan-12 6:45
SledgeHammer0130-Jan-12 6:45 
GeneralRe: WPF Dialog Service via Binding Pin
Adrian Alexander30-Jan-12 8:01
Adrian Alexander30-Jan-12 8:01 
GeneralRe: WPF Dialog Service via Binding Pin
SledgeHammer0130-Jan-12 8:28
SledgeHammer0130-Jan-12 8:28 
GeneralRe: WPF Dialog Service via Binding Pin
Adrian Alexander30-Jan-12 9:22
Adrian Alexander30-Jan-12 9:22 
GeneralRe: WPF Dialog Service via Binding Pin
SledgeHammer0130-Jan-12 10:43
SledgeHammer0130-Jan-12 10:43 
GeneralRe: WPF Dialog Service via Binding Pin
Adrian Alexander30-Jan-12 14:28
Adrian Alexander30-Jan-12 14:28 
AnswerRe: WPF Dialog Service via Binding Pin
SledgeHammer0130-Jan-12 14:54
SledgeHammer0130-Jan-12 14:54 
Actually, you suggested creating ICommands for each before Smile | :) .

Obviously, I think we can agree that the 45 method approach is bad Smile | :) .

Going the single callback / switch (result) route is starting to get better Smile | :) .

However, going back to my real world scenario of 15 message boxes in my VM, I'd need to create 15 methods. HandleMsgBox1(...), HandleMsgBox2(...), etc. because each MessageBox has its own handling code. You also complicate the handling code in certain scenarios because you may have to pass around a bunch of objects that you normally wouldn't have to.

I really suggest you read up on ServiceLocator here and why its so awesome:

Using a Service Locator to Work with MessageBoxes in an MVVM Application[^]

As you can see, you can do this WITHOUT the 15 extra functions and maintain testability Smile | :) . That was my point. Ok, I'll admit it to make you happy Smile | :) , your technique "fundamentally" works, I never said it did not... BUT it requires jumping through too many hoops to get it to work in the real world and maintain testability.

You can write your code any way you wish, but the "standard" MVVM practice is to use ServiceLocator, DI or MEF.

Personally, as I said, I use DI in new code which is ServiceLocator on steroids.

All the WPF "big boys"... say Pete O'Hanlon and Sacha Barber (who you can obviously respect a lot more then me Smile | :) ) are using MEF.
GeneralRe: WPF Dialog Service via Binding Pin
Pete O'Hanlon30-Jan-12 23:06
mvePete O'Hanlon30-Jan-12 23:06 
GeneralRe: WPF Dialog Service via Binding Pin
Adrian Alexander6-Feb-12 19:45
Adrian Alexander6-Feb-12 19:45 
GeneralRe: WPF Dialog Service via Binding Pin
Mycroft Holmes30-Jan-12 13:20
professionalMycroft Holmes30-Jan-12 13:20 
GeneralRe: WPF Dialog Service via Binding Pin
SledgeHammer0130-Jan-12 13:32
SledgeHammer0130-Jan-12 13:32 
AnswerRe: WPF Dialog Service via Binding Pin
Pete O'Hanlon30-Jan-12 5:48
mvePete O'Hanlon30-Jan-12 5:48 
GeneralRe: WPF Dialog Service via Binding Pin
Adrian Alexander30-Jan-12 5:49
Adrian Alexander30-Jan-12 5:49 
Questionerror SocketError.AccessDenied on silverlight Pin
ptcnbaoduong29-Jan-12 15:17
ptcnbaoduong29-Jan-12 15:17 
AnswerRe: error SocketError.AccessDenied on silverlight Pin
Mycroft Holmes29-Jan-12 16:40
professionalMycroft Holmes29-Jan-12 16:40 
AnswerRe: error SocketError.AccessDenied on silverlight Pin
Dean Oliver29-Jan-12 18:34
Dean Oliver29-Jan-12 18:34 
AnswerRe: error SocketError.AccessDenied on silverlight Pin
Abhinav S29-Jan-12 18:54
Abhinav S29-Jan-12 18:54 
Questionsilverlight Pin
ptcnbaoduong29-Jan-12 15:16
ptcnbaoduong29-Jan-12 15:16 
AnswerRe: silverlight Pin
Dean Oliver29-Jan-12 18:30
Dean Oliver29-Jan-12 18:30 
QuestionBasic Silverlight Solution Structure Pin
Kevin Marois29-Jan-12 9:51
professionalKevin Marois29-Jan-12 9:51 
AnswerRe: Basic Silverlight Solution Structure Pin
Mycroft Holmes29-Jan-12 13:42
professionalMycroft Holmes29-Jan-12 13:42 
AnswerRe: Basic Silverlight Solution Structure Pin
Abhinav S29-Jan-12 19:00
Abhinav S29-Jan-12 19:00 
Questionbinding one listview to two observablecollections Pin
Vincent Beek28-Jan-12 23:08
Vincent Beek28-Jan-12 23:08 
AnswerRe: binding one listview to two observablecollections Pin
Pete O'Hanlon29-Jan-12 2:14
mvePete O'Hanlon29-Jan-12 2:14 

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.