I spent a lot of time writing a Windows Presentation Foundation application this weekend. It is a Podcast application for ClariFeed. Mostly I’m writing it because I’m not happy with any of the current podcast applications out there. Also it makes a good addition to ClariFeed. Though I probably should have spent the time working on improving the front end of ClariFeed.
Writing this application I learned a great deal about WPF. One thing I learned is that the WinForms method InvokeRequired() no longer exists. It has been replaced with Dispatcher.CheckAccess(). The new Dispatcher object is simpler to use than the old InvokeRequired. Additionally, delegate syntax has been greatly simplified.
The other thing I learned that makes life very simple is the BackgroundWorker class. BackgroundWorker is essentially the same class that you wrote yourself to execute code on a different thread in previous versions. But now the helper class already exists for you.
Another thing I learned is that it is very easy to make plain looking WPF applications. However, you need to be a graphic designer if you want your app to be beautiful. No doubt I’ll finish this application in another weekend or two, and then spend forever trying to make it look pretty.
Other lessons in no particular order:
- I am using Visual Studio 2005 and writing Xaml by hand. It is far, far faster this way. The designer in Visual Studio is ok, but it still is slower than just typing in the Xaml.
- Microsoft Expressions Blend sucks. For creating a generic windows application (albeit one made with Xaml) it is just incredibly inefficient. However, it does have one use:
- The designer window in VS2k5 does not have an events tab. Auto-wire up of events is extremely convenient. It saves having to look up the properties of each event when you are typing them in. However, VS2k5 makes you look them up every time. However, if you open up Expression Blend, browse to your control, and switch to the events tab in Expression Blend, you can auto wire up your event. It will even open up the correct spot in Visual Studio for you!
I know, that seems pretty clunky. But as long as I had all the apps open, it was faster than trying to look up the event signature by hand.