Click here to Skip to main content
15,912,329 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Binding list of items to IntemsControl in WPF Pin
Abhinav S1-Feb-12 16:26
Abhinav S1-Feb-12 16:26 
GeneralRe: Binding list of items to IntemsControl in WPF Pin
Wayne Gaylard1-Feb-12 19:06
professionalWayne Gaylard1-Feb-12 19:06 
QuestionFocusing on elements in MVVM Pin
mi_n30-Jan-12 22:42
mi_n30-Jan-12 22:42 
AnswerRe: Focusing on elements in MVVM PinPopular
Pete O'Hanlon30-Jan-12 23:03
mvePete O'Hanlon30-Jan-12 23:03 
GeneralRe: Focusing on elements in MVVM Pin
Pete O'Hanlon31-Jan-12 3:34
mvePete O'Hanlon31-Jan-12 3:34 
GeneralRe: Focusing on elements in MVVM Pin
Wayne Gaylard31-Jan-12 3:39
professionalWayne Gaylard31-Jan-12 3:39 
GeneralRe: Focusing on elements in MVVM Pin
Pete O'Hanlon31-Jan-12 3:47
mvePete O'Hanlon31-Jan-12 3:47 
GeneralRe: Focusing on elements in MVVM Pin
Wayne Gaylard31-Jan-12 3:56
professionalWayne Gaylard31-Jan-12 3:56 
GeneralRe: Focusing on elements in MVVM Pin
SledgeHammer0131-Jan-12 5:11
SledgeHammer0131-Jan-12 5:11 
GeneralRe: Focusing on elements in MVVM Pin
SledgeHammer0131-Jan-12 6:18
SledgeHammer0131-Jan-12 6:18 
GeneralRe: Focusing on elements in MVVM Pin
SledgeHammer0131-Jan-12 6:56
SledgeHammer0131-Jan-12 6:56 
GeneralRe: Focusing on elements in MVVM Pin
SledgeHammer0131-Jan-12 7:50
SledgeHammer0131-Jan-12 7:50 
GeneralRe: Focusing on elements in MVVM Pin
mi_n31-Jan-12 6:58
mi_n31-Jan-12 6:58 
GeneralRe: Focusing on elements in MVVM Pin
SledgeHammer0131-Jan-12 7:21
SledgeHammer0131-Jan-12 7:21 
GeneralRe: Focusing on elements in MVVM Pin
mi_n31-Jan-12 9:36
mi_n31-Jan-12 9:36 
QuestionWPF Dialog Service via Binding Pin
Adrian Alexander29-Jan-12 23:18
Adrian Alexander29-Jan-12 23:18 
AnswerRe: WPF Dialog Service via Binding Pin
SledgeHammer0130-Jan-12 5:11
SledgeHammer0130-Jan-12 5:11 
GeneralRe: WPF Dialog Service via Binding Pin
Adrian Alexander30-Jan-12 5:14
Adrian Alexander30-Jan-12 5:14 
GeneralRe: WPF Dialog Service via Binding Pin
SledgeHammer0130-Jan-12 5:20
SledgeHammer0130-Jan-12 5:20 
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 
Adrian Alexander wrote:
As you just pointed out, making the lamdas into methods would then mean you can
directly call them for testing, so I don't see any problem there.



Why would I want to break a single line of code into a separate method? So your "time saver" technique now requires a ton more work? Every single response I get from the message box, I would need to put into a separate method to test it? I suppose you could just have one method which takes the MessageBoxResult and have all your lambdas call it with the appropriate value. Seems silly though. 3 lambdas + 1 method.

Adrian Alexander wrote:
In fact, those "lambdas" are ICommands like any other in the VM.


Yes, VMs expose ICommands, but not every bit of functionality in the VM is broken out into a separate ICommand. Thats absurd. ICommands are only created when you need to invoke some operation from the UI.

Using your technique, I would need to create 3 separate methods or 3 separate ICommands (if my message box happens to display Ok, Cancel & Retry for example). If I do go ahead and create ICommands, oh boy... now I need 3 separate ICommand fields and the code to new up those ICommands, etc. So much work!!! Smile | :)

Now imagine if my VM displays messages boxes in 15 places and each message box has 2 or 3 buttons. Now I need 30 to 45 separate methods just to handle message box responses!!! OH MY LORD.

Adrian Alexander wrote:
In any case, the technique I suggest could easily be adjusted to work with a
switch statement if you like doing it that way.


A better design then what you have now, but still lacking testability. You would again need to break out all the case statements into separate methods. ServiceLocator has no such requirement.

Adrian Alexander wrote:
I prefer using binding (which everyone uses in the WPF apps anyway) and you're
determined to use a service locator (which I don't see any need to introduce
into my code).


You don't seem to have a clear understanding of the difference between the two.

Actually, I don't even use ServiceLocator in my new apps anymore. I use DI. If you took a survey on CP, you'll find almost everybody uses MEF and/or DI to pass around services.

Look, I'm not against coming up with new things... but you have yet to show how your VM remains testable without breaking out every message box case handling code into a separate method and without adding a lot of work for the developer.

ServiceLocator, DI and MEF have already solved all these problems.
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 

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.