XPF: Build 10 - Breaking Changes and System.Windows

Prior to Build 10 all XPF controls ultimately inherited from System.Windows.DependencyObject and we used a wide variety of classes from within the System.Windows.* namespaces (Color, Rect, Size, Point etc).  Doing so saved us a lot of time, we didn’t need to recreate a lot of utility stucts and we were able to use Dependency Properties “for free” – which also meant we got to use Windows data binding and animation “for free” too. As it turned out, free was not free as in beer.  Silverlight on WP7 hides a lot of useful information in Dependency Property that we need to make data binding work which resulted in some less than elegant workarounds.  There was also an “ingestion question” over whether the use of such classes from within an XNA application on WP7 would result in Marketplace ingestion failure.

As such we’ve decided to remove all our dependencies on System.Windows.* – this has a few downsides and a lot of upsides.

Downsides mean that there are quite a few breaking changes, but they’re nearly all easily resolved.  On Windows you no longer need to reference PresentationCore, PresentationFramework or WindowsBase – remove these references and recompile – you should find that the required equivalent classes are now in RedBadger.Xpf.  On WP7 there aren’t really any references to remove (you still need to reference System.Windows to access Application and ObservableCollection<T>) but you should be able to remove all “using System.Windows” statements from your code and recompile.

On the upside, XPF becomes a lot lighter and purer.  We’ve introduced a new and updated replacement for Dependency Properties – Reactive Properties.  Reactive Properties are strongly typed and use Reactive Extensions (Rx) to provide much of the same behaviours as Dependency Properties and a lot more besides.  Via IObservable<T> and IObserver<T> they drive the new data binding system with an improved, yet still familiar syntax.  We’ll be discussing Reactive Properties and data binding a lot more in our next few posts.

The other great upside is that Xbox support is now on the cards.  Rx has support for XNA 3.1 on the Xbox (as of build 1.0.2677.0) but we’ll need to wait until Rx for XNA 4.0 arrives and we can deploy XNA 4.0 applications to the Xbox before we can start testing.

The Getting Started post (and it’s sample code) have been updated to compile against Build 10.

As always – we want your feedback.