Sunday, February 15, 2009

Introduction to WPF with IronPython

Windows Presentation Foundation (WPF) is the successor to Windows Forms; a powerful user interface library for .NET. Where Windows Forms is built on GDI/GDI+ for drawing the GUI, WPF is built on DirectX. This means that much of the work can actually be done on the GPU (the graphics card), and so despite being richer and easier to theme WPF can perform better than Windows Forms.

Mark Bloodworth has been experimenting with WPF and IronPython:
Having scanned a few pages, I decided to create a very simple app that included databinding and an event handler. Armed with Notepad++, XamlPad and a command prompt I set out.

First step was a little C#. I created a class as detailed here that adds a little dynamic-ness to WPF.
WPF is also used by Silverlight - which was originally called WPF/E - and is one of the few Microsoft projects to go from a boring codename to an interesting final release name; WPF itself was originally codenamed Avalon. WPF has a new set of controls, although still nothing like as many as Windows Forms, and uses an XML dialect called XAML for describing user interfaces.

WPF was new in .NET 3.0, which added several new libraries to .NET 2.0 and is the base version of .NET that comes with Vista. It isn't a new version of the CLR (Common Language Runtime), but instead extends .NET 2.0. Both .NET 3.5 and .NET 2.0 SP1 have been released since .NET 3.0. Although several of the 3.0 libraries are being brought into Mono (see the Olive project), the Mono team have said in the past that they have no interest in porting WPF to run on Mono.

As the Silverlight UI is based on WPF and Moonlight (the Mono Silverlight implementation) is well on the way (Moonlight 1 is released and Moonlight 2 is progressing well) perhaps this decision will be revisited.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.