Sunday, March 22, 2009

Binding dynamic types in WPF using IronPython and DLR

There have been a couple of projects in the past integrating IronPython into WPF XAML to add more dynamic features:
WPF, Windows Presentation Foundation, is the new User Interface library by Microsoft which is part of .NET 3.0. It uses the graphics card GPU to do UI drawing, so as well as being more powerful than Windows Forms it can also perform better. It isn't available in Mono though, so has the disadvantage of not being cross-platform. XAML is the XML markup used to describe GUIs, transformations, etc in WPF and Silverlight (which uses a subset of WPF XAML).

Here's (yet) another way of adding dynamic features to WPF. This time it is for dynamic binding:
Covered in this post:
  • Creating classes in IronPython and comparing with C# classes. Adding public properties in IronPython class.
  • Using classes/interfaces in IronPython class which is in the hosting assembly. For example, if the application hosting the DLR and executing the IronPython class at runtime has an interface IDyn, this article covers on how to use that interface within the Python script.
  • Accessing the dynamic type created in the IronPython and making an instance of it.
  • Finally, binding the dynamic type to WPF controls.

No comments:

Post a Comment

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