From Windows Forms to WPF with MVVM

This talk illustrates how Windows Presentation Foundation can dramatically improve the experience of developers, not just designers. Two versions of a simple application will be demonstrated, one developed using Windows Forms, and one using the same approach in WPF. By showing the same application in both technologies, we will show how a short learning curve can be used to migrate development to WPF.

I’ll then discuss three new features of WPF: Data Binding, Templating, and Commanding. I’ll show how they enable a new application architecture, the Model-View-ViewModel pattern, and illustrate how rethinking our approach to design in terms of these three features allows for huge gains in flexibility, testability, and maintainability of our applications.

Finally, we’ll look at third version of our application, a rewrite of our previous application using the Model-View-ViewModel pattern.

This talk is approximately 1 hour and 15 minutes in length.

Presentation Material:

Slides: Windows Forms to WPF with MVVM

Source: Sample Source Code from WPF with MVVM Talk

Comments

8 Responses to “From Windows Forms to WPF with MVVM”
  1. Kate says:

    Hello Reed,

    Please let me know where can I find the link to this talk “From Windows Forms to WPF with MVVM”? I have read through the series and it helped me in understanding the basics of WPF-MVVM as a newbie.

    Best regards.

  2. Tetsu says:

    Hi,

    I have been looking for some good code/article targeted to WinForms programmers and found that the sample code (WPFWithMVVM) was excellent. But, I have a couple of questions:

    (1) In the MainView.xaml, the ListBox’s DataTemplate directly uses the model class – i.e., Animal. The bindings are set between the view and model. Does this violate the spirit that views should know nothing about models?

    (2) Could you tell me how I can separate out the DataTemplate portion of the MainView.xaml to a separate xaml file?

    I have just started learning WPF+MVVM. I’d appreciate it if you’d find some time to respond back to the questions.

    Thank you very much for the sample code.

    • Reed says:

      Thanks for the questions! I’ll try to answer the best I can.

      1) This really depends on your approach. I personally see it as a layered model, where nothing should ever look “up”, but you can look down as much as you want. As such, I don’t have a problem with the View binding to the Model, it’s more making sure the Model/VM doesn’t see the View. There are other people who disagree on this point, but I find that practicality outweighs purity in this respect, and it’s often just far simpler to use the Model directly than force a dev to make a “ViewModel wrapper” that’s pure boilerplate code.

      2) You could use a merged resource dictionary to do this. See: http://msdn.microsoft.com/en-us/library/aa350178(v=vs.110).aspx

      -Reed

Trackbacks

Check out what others are saying about this post...
  1. Social comments and analytics for this post…

    This post was mentioned on Twitter by Caspar_Kleijne: From Windows Forms to WPF with MVVM http://reedcopsey.com/talks/from-windows-forms-to-wpf-with-mvvm/ #wpf #csharp…



Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!