Click here to Skip to main content
15,886,919 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Need some Simple Code Pin
_Maxxx_15-Aug-11 20:08
professional_Maxxx_15-Aug-11 20:08 
AnswerRe: Need some Simple Code Pin
Glosse16-Aug-11 4:30
Glosse16-Aug-11 4:30 
GeneralRe: Need some Simple Code Pin
_Maxxx_17-Aug-11 13:52
professional_Maxxx_17-Aug-11 13:52 
GeneralRe: Need some Simple Code Pin
SledgeHammer0117-Aug-11 14:15
SledgeHammer0117-Aug-11 14:15 
GeneralRe: Need some Simple Code Pin
_Maxxx_17-Aug-11 19:57
professional_Maxxx_17-Aug-11 19:57 
GeneralRe: Need some Simple Code Pin
SledgeHammer0118-Aug-11 5:08
SledgeHammer0118-Aug-11 5:08 
GeneralRe: Need some Simple Code Pin
Glosse18-Aug-11 7:34
Glosse18-Aug-11 7:34 
GeneralRe: Need some Simple Code Pin
SledgeHammer0118-Aug-11 9:32
SledgeHammer0118-Aug-11 9:32 
Well, sometimes I find people who over complicate stuff for no reason to be a bit pretentious and they are just trying to impress themselves. In the case of MVVM however, its just simply a better way to write WPF code. When I first saw it, I thought like you: "geez, this is stupid... its making things more complicated", but once I got used to it, I saw *WHY* its good.

For example, lets say you implement a dialog box that has a few buttons and a ListView, chances are you populate most if not all of the data in the constructor, manually insert stuff into the ListView, subscribe to lots of events, have a lot of duplicate code and tie all of the dialogs logic closely to the ListView. Now lets say your boss is a douche and comes to you in a month and says "I don't like the ListView, lets change it to a WidgetView". Well, now you pretty much need to re-write and re-test all your dialog code. Sux 2 b U. If you had written it in the MVVM style, you would have been able to swap out the ListView for a WidgetView in about 5 minutes and not have to re-write or re-test anything. You'd also have a lot less code, your dialog would come up faster because you would be lazy loading all your data (one of the things that MVVM kind of pushes indirectly) and you could write automated tests for your dialog box if thats something your company does.

Yes... its much easier to quickly whip out:

somecontrol.SomeEvent += <tab><tab>

vs. creating a RelayCommand and implementing its 2 event handlers, but you can pretty much write a macro for that in about 2 seconds. Theres already a built in macro for defining dependency properties, so adding one for the RelayCommand is just c&p pretty much.

The code does end up being more elegant, but the advantage for me is that I don't have to keep changing the dialog box code until the boss is happy with it, I just tweak some xaml.
GeneralRe: Need some Simple Code Pin
_Maxxx_18-Aug-11 13:41
professional_Maxxx_18-Aug-11 13:41 
GeneralRe: Need some Simple Code Pin
Mycroft Holmes18-Aug-11 14:54
professionalMycroft Holmes18-Aug-11 14:54 
GeneralRe: Need some Simple Code Pin
_Maxxx_18-Aug-11 16:01
professional_Maxxx_18-Aug-11 16:01 
GeneralRe: Need some Simple Code Pin
SledgeHammer0118-Aug-11 18:47
SledgeHammer0118-Aug-11 18:47 
AnswerRe: Need some Simple Code Pin
Abhinav S19-Aug-11 1:47
Abhinav S19-Aug-11 1:47 
AnswerRe: Design and Styling Pin
SledgeHammer0115-Aug-11 6:47
SledgeHammer0115-Aug-11 6:47 
GeneralRe: Design and Styling Pin
Richard MacCutchan15-Aug-11 7:53
mveRichard MacCutchan15-Aug-11 7:53 
GeneralRe: Design and Styling Pin
SledgeHammer0115-Aug-11 8:04
SledgeHammer0115-Aug-11 8:04 
AnswerRe: Design and Styling Pin
Oludayo Alli15-Aug-11 23:09
Oludayo Alli15-Aug-11 23:09 
GeneralRe: Design and Styling Pin
Nicky Carpenter17-Aug-11 6:29
Nicky Carpenter17-Aug-11 6:29 
AnswerRe: Design and Styling [modified] Pin
Oludayo Alli19-Aug-11 3:42
Oludayo Alli19-Aug-11 3:42 
GeneralRe: Design and Styling Pin
AAC Mike16-Aug-11 3:01
AAC Mike16-Aug-11 3:01 
GeneralRe: Design and Styling Pin
SledgeHammer0116-Aug-11 5:09
SledgeHammer0116-Aug-11 5:09 
GeneralRe: Design and Styling Pin
Member 376360816-Aug-11 8:53
Member 376360816-Aug-11 8:53 
GeneralRe: Design and Styling Pin
SledgeHammer0116-Aug-11 10:11
SledgeHammer0116-Aug-11 10:11 
GeneralRe: Design and Styling Pin
Pete O'Hanlon16-Aug-11 10:21
mvePete O'Hanlon16-Aug-11 10:21 
GeneralRe: Design and Styling Pin
SledgeHammer0116-Aug-11 10:34
SledgeHammer0116-Aug-11 10:34 

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.