views:

1338

answers:

8

I've been developing Winforms applications in C# for a few years now and have been interested in moving future development toward WPF, mainly because of the positive things I've been hearing about it. But, I'm wondering what sort of hurdles others have had to overcome as they migrated to WPF. Was there a significant hit to your productivity or any particular issues which you found challenging?

+8  A: 

I'm not sure I can give you just one hurdle, because it is a complete departure from WinForms. My suggestion is get Adam Nathan's WPF Unleashed, forget everything you know about building UI's with any previous technology (Winforms, MFC, Java) and begin again at square one.

If you try and do it any other way it will cause utter frustration.

ETA: the reason I say to just start from scratch is because sometimes it's easier to learn new concepts if you go in with a clean slate. In the past, I've discovered that I can be my own worst enemy when it comes to learning something new if I try to carry knowledge from technology to technology (e.g. thinking that doing asmx web services for years precludes me from reading the first couple chapters of a WCF book).

Don
Thank you Don for the info. Looks like a book that has received a good amount of positive reviews.
itsmatt
Don - got the book and it is really well written and has been helpful - thanks again!
itsmatt
+3  A: 

In my admittedly limited experience with WPF, the bigger hurdles include a complete overhaul of my mental model for how UIs are built and the new terminology that needs to be learned as a result of that. It may be that others have an easier time adjusting to the model, though. I can see how someone coming from best practices in the web world would find the transition much more natural.

There was definitely a significant hit to my productivity (so significant that I'm not yet comfortable with the idea of going to my employer and saying "let me do this with WPF instead of Winforms"). I don't think that I'll never get there, but I need to develop some additional comfort with the technology through practice in my personal time.

I didn't run into any particular issues that I found to be more challenging than any others. I believe Adam Nathan's WPF Unleashed was mentioned elsewhere, and that's definitely a worthwhile read. I've also heard good things about Charles Petzold's book, though I can't personally vouch for it.

Greg D
Thanks, Greg. Appreciate your input re: productivity and will check out Petzold's book too. I heard him on dotNet rocks a couple of weeks ago and he was interesting.
itsmatt
+1  A: 
  1. You cannot turn off anti-alias.
  2. Your users need Vista or XP SP2 with .net 3.x framework.
  3. If you want to use winforms be aware of the Air Space (one solution for D3D here).

These are the major issues for me. Other than that, I'm all for it, its way more than looks.

Artur Carvalho
A: 

Well, for me it was the fact that controls in WPF behave rather different from those in WPF (for example, when it comes to positioning in the form). You have to understand the difference as soon as possible to use it successfully and productively.

Łukasz Sowa
+1  A: 

The Microsoft Learning website has a useful introduction, which I believe is available free if you have a Microsoft Passport account https://www.microsoftelearning.com/eLearning/courseDetail.aspx?courseId=85488

John Ferguson
Thanks for the link, John. I'll check it out!
itsmatt
+1  A: 

If the WinForms app has a proper Object model architecture defined(More like an MVC model architecture) I think it wont take much time to migrate your UI to WPF. WPF has organized its visual elements heirarchically(VisualTree) and RoutedEvents and RoutedCommands are totally new concepts in WPF. and obviously there are more stuffs like DataTemplate/Controltemplate all are at XAML level. All of these makes a very powerful and easy way to accomplish great user experience. So my major point here is that you can expect just your Object model reusable(With some modifications) in WPF and everything else on the Winforms project need to throw off. Ofcourse all other layers need not be modified(Comunication Layer/DataLayer)

Jobi Joy
+1  A: 

I'm in the same boat. I've been programming using winforms for so long. Now I keep decided that I'm going to learn WPF and start doing everything with it. The hardest thing for me is getting used to using XAML primarially for the UI rather than C# code, and a lot of the properties are different in WPF. (IE - to change a label's text you have to change the Content property). So my biggest problem is to get my head out of winforms and get it into a whole new way of thinking.

Joel
A: 

Even with 20+ yrs experience I found WPF to have a steep learning curve. I attempted to do my latest project using WPF but the lack of built in controls (like NumericUpDown for example) and problems getting DataBinding to work with a business object forced me to fall back to Winforms for this project but I hope to do future projects with it. Almost all the code I wrote (vs what the designer generated) was reusable when I switched between WPF and Winforms.

Chris Bennet