I have been struggling with WPF on a fairly constant basis for the last 9 months, and have come to respect it in some ways, and be
quite disappointed with it in others. Here are my thoughts, feelings and bugbears
about Windows Presentation Foundation.
The good
- The ability to position on screen items using a selection of layout panes is far
better than Windows Forms
- The ability to hit test items on a Canvas is very useful - A few authors have
derided the Canvas as not being very useful - I think they're missing something
- The animation classes are well thought out and allow many possibilities.
- Everything is a class or enum. Sometimes this is a little painful, as some
objects (e.g. GraphicsPath) have to be composed from other classes, but it makes
some sense from a purist point of view.
- Creating rich graphic objects like buttons, is far easier than in GDI+, without
having to use bitmaps to represent the button states
- The Themes (I really mean skinning methods here, not OS themes, but I'm confused
over the difference), i.e. the ability to define the look and feel of each
object (button, listview etc) from a single location is a huge boon. Being able
to replace the entire visual tree of any object is an interesting concept, that
must have taken quite some effort to deliver.
- XAML is quite a hoopy thing all on its own. The fact that you can dredge around
in the code is something missing from Cocoa (the Mac equivalent of wpf - well,
sort of)
- 3D. It was never easy, now it almost is. WPF runs on DirectX rather than on
Windows, so offers a far richer graphical underbelly.
The bad
- You cannot advance one frame (or a fraction of a second) into an animation and
freeze it - I have since found out how to do this, see the controlling the
animation page.
- Animations cannot be exported (yet?) to a video format.
The above two items mean that all of the great animation work done in wpf is of
no use to animators beyond creating flash style animations for web pages or
windows forms.
- WPF has most things we had previously. Is this a good idea? I mean do we really
need another implementation of the richtextbox? OK, its useful, but I want a
syntax highlighting, intellisense enabled editor now, not a crumby old rich text
box.
- I also want a property grid.
- I also want a docking grid, where you can drag out panes into new windows, and
merge tham ack in in another location. I see even the Expression Blend
developers have given up on this one and have a cheap little undock/redock
button like the pin button.
Expression Blend has both of the above. Can we have them as re-usable controls
please?
- The media stuff is a little thin. I want to open a piece of media, save the
sound as a wav file, export a few frames, a short clip maybe. I can't.
- Most of all I want to create a new piece of media, add the video frames one by
one, or from an Animation, add a few audio files and mix them, then save it. I
can't.
The ugly
- Expression Blend - It's probably me, but I can't get it to do anything. I just
end up hacking at the XAML. I don't get it. I have no idea how a graphic
interface designer would get it either.
- Setting property values has taken a step backwards in some cases. Especially in
Templates and Setters. Everything is a key value pair, or property of the format
someproperty="..." As there is no intellisense, it's difficult to guess what the
properties might be, and what enumerated values might be allowed.
Overall, my impression of WPF is very positive despite my frustration with the
long and painful learning curve. I feel like a dog with a new bag of tricks, and
I am well aware that I haven't even opened all of the tricks yet. WPF is a far
larger subject than Windows Forms/GDI+ ever was, and has far more capability. I
hope my frustrations will be short term ones as I begin to understand more, and
also as more becomes available from Microsoft and also the developer community.
One sobering observation I have come to realize is that Windows Forms/GDI+ are
now deprecated technologies even if no-one has said so. Nothing has changed in
GDI+, despite its shortcomings, since 2005. All of Microsoft's visual efforts
appear to be going into WPF, and rightly so, as it has far more potential.
For those of you who jumped from Visual Basic to .Net, I would suggest the jump
from Windows Forms/GDI+ to WPF is far bigger.