Click here to Skip to main content
15,888,461 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: MVVM Blues... Pin
SledgeHammer0126-Jan-12 12:24
SledgeHammer0126-Jan-12 12:24 
GeneralRe: MVVM Blues... Pin
Tom Delany26-Jan-12 14:25
Tom Delany26-Jan-12 14:25 
GeneralRe: MVVM Blues... Pin
Dean Oliver24-Jan-12 19:05
Dean Oliver24-Jan-12 19:05 
GeneralRe: MVVM Blues... Pin
SledgeHammer0125-Jan-12 13:37
SledgeHammer0125-Jan-12 13:37 
AnswerRe: MVVM Blues... Pin
Ravi Bhavnani25-Jan-12 12:25
professionalRavi Bhavnani25-Jan-12 12:25 
GeneralRe: MVVM Blues... Pin
Kevin Marois29-Jan-12 9:23
professionalKevin Marois29-Jan-12 9:23 
AnswerRe: MVVM Blues... Pin
Dean Oliver29-Jan-12 18:50
Dean Oliver29-Jan-12 18:50 
GeneralRe: MVVM Blues... Pin
Kevin Marois30-Jan-12 7:49
professionalKevin Marois30-Jan-12 7:49 
The whole point of MVVM is not to have code in your code behind
I completely disagree.

The point of MVVM, or any design pattern for that matter, is separation of concerns, not "no code behind". No where in this does is mandate that you cannot have code in the code-behind.

And, the view is already coupled to the view model when you do

this.DataContext = new MyViewModel();


The code I posted did not make any reference to the business or data layers, so it did not violate the design pattern.

However, I do like the code you posted and agree that a command is the way to go. I posted my snippet as an example of calling into the VM from the view. Like I said, the two are already coupled, and the code didn't reference data or the BL, so there's no reason not to do it.
Everything makes sense in someone's mind

GeneralRe: MVVM Blues... Pin
Dean Oliver30-Jan-12 18:02
Dean Oliver30-Jan-12 18:02 
GeneralRe: MVVM Blues... Pin
Kevin Marois30-Jan-12 8:03
professionalKevin Marois30-Jan-12 8:03 
GeneralRe: MVVM Blues... Pin
Dean Oliver30-Jan-12 18:03
Dean Oliver30-Jan-12 18:03 
GeneralRe: MVVM Blues... Pin
Pete O'Hanlon31-Jan-12 0:56
mvePete O'Hanlon31-Jan-12 0:56 
QuestionSilverlight App versus Silverlight Busines App Pin
Kevin Marois24-Jan-12 8:09
professionalKevin Marois24-Jan-12 8:09 
AnswerRe: Silverlight App versus Silverlight Busines App Pin
Abhinav S25-Jan-12 0:45
Abhinav S25-Jan-12 0:45 
Questiondynamicaly open elements from a xaml resource Pin
Giorgi Nistor23-Jan-12 22:37
Giorgi Nistor23-Jan-12 22:37 
AnswerRe: dynamicaly open elements from a xaml resource Pin
Giorgi Nistor23-Jan-12 23:50
Giorgi Nistor23-Jan-12 23:50 
GeneralRe: dynamicaly open elements from a xaml resource Pin
Giorgi Nistor25-Jan-12 4:07
Giorgi Nistor25-Jan-12 4:07 
QuestionMVVM architecture Pin
mi_n22-Jan-12 21:18
mi_n22-Jan-12 21:18 
AnswerRe: MVVM architecture Pin
Wayne Gaylard22-Jan-12 21:59
professionalWayne Gaylard22-Jan-12 21:59 
GeneralRe: MVVM architecture Pin
mi_n23-Jan-12 8:51
mi_n23-Jan-12 8:51 
GeneralRe: MVVM architecture Pin
Dean Oliver23-Jan-12 18:35
Dean Oliver23-Jan-12 18:35 
GeneralRe: MVVM architecture Pin
mi_n24-Jan-12 21:03
mi_n24-Jan-12 21:03 
AnswerRe: MVVM architecture Pin
Dean Oliver25-Jan-12 19:35
Dean Oliver25-Jan-12 19:35 
Questionconnectionstring Pin
arkiboys20-Jan-12 1:10
arkiboys20-Jan-12 1:10 
SuggestionRe: connectionstring Pin
Dean Oliver27-Jan-12 22:33
Dean Oliver27-Jan-12 22:33 

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.