To WPF or not to WPF, that is the question?

guest2013-1

guest
Joined
Aug 22, 2003
Messages
19,800
So I'm bored. And when I get bored I get curious. Plus a bout of insomnia isn't helping. So I'm thinking of diving head first into WPF.

Any advice on where to start? I'm like a kid in the candy store with a gazillion petrillion Rands and I can buy anything, except I don't know what to do first! :p
 

shogun

Expert Member
Joined
Sep 9, 2005
Messages
2,246
WPF is definately worth the time spent learning it. Been using WPF for 2 years now, and won't touch winforms again, unless I port my apps to mono.. and even then i'd rather go silverlight.

Topics you need to know / read up on:

Dependency Properties
- Crucial for databinding
- Know how they get their values... a dependency property is basically a lookup on a few different sources, in an order of priority.

Data Binding
- The most powerful aspect to WPF in my opinion. This deserves most of your time.

If you are into graphics drawing... then definately look into Visuals

The retained Graphics system (vs GDI's immediate graphics)

Dependency Injection and Inversion of Control (WPF is suited well to this.. and the major framework (PRISM) uses this approach)

Layout panels
- StackPanel vs Grid vs WrapPanel etc

Control Templates
- You can change the structure of a control very quickly with control templates

Resourcing and styling
- You need to get this right if you want to theme an application properly

Transforms
- Render and layout transforms will help you do things like rotate objects etc

Animation and Clocks
- Very easy to learn the basics, and useful for adding interactivity to an application.


If you want good guidence... the PRISM framework is the way to go. It's classic MVVM and works very well in WPF.

Beware... it's a steep learning curve and can take a while to "get it". It's quite a departure from the winforms mindset. Well worth it though... and it'll help when you want to jump into silverlight.

A good book that I read 2 years back was Sams Windows Presentation Foundation Unleashed. There's a lot of new stuff out now, but everything in that book is still relevent.

On another note... if you start playing with WPF... do your reading up front into the concepts and class hierarchy. If you don't, you'll stumble around in the dark just getting the small things right. MSDN is your friend and document the classes very well. Lot's of concepts explained very well there too.

You might also want to follow Josh Smith's blog. He's got a lot of stuff on code project as well.

nJoy
 
Last edited:

guest2013-1

guest
Joined
Aug 22, 2003
Messages
19,800
thnx man, will go ahead and do most of what you said... busy writing file parser app as a start and will move on from there
 

diegoa

Expert Member
Joined
Mar 15, 2009
Messages
1,618
WPF is worth learning. Btw Visual Studio 2010 was written with WPF :)
 

shogun

Expert Member
Joined
Sep 9, 2005
Messages
2,246
WPF is worth learning. Btw Visual Studio 2010 was written with WPF :)

Yeah... I hope it's faster than the release candidates. There were complaints that it was under performing. I'm looking forward to a couple of things in framework 4... namely better rendering of small text in WPF, and parallel extensions. Played with parallel extensions when they came out a year ago, and they're awesome... but they were tricky to use in a lot of situations.

The biggest problem that you will have with WPF is learning to code for performance. You can do so much with it, but doing things the easy way (like using shapes instead of visuals to render large numbers of graphics) will land you in trouble a lot of the time, with a dog slow app.

Included in the WPF packaging contents is enough rope to hang yourself with... and a lot of people mistake the slow performance of their applications with WPF being a poor platform. Quite the opposite is true. You aren't limited to one way of doing things, so there's always another way to do something better. There's a lot of performance in WPF if you look for it in the right places.
 
Top