Want to follow this site? Here's the RSS feed.

Using Xaml to Represent Objects (Video)

Saturday, March 25, 2006

Since most of the WinFX (.NET) world is going to declarative programming, I think it would be wise for us API designers to starting thinking the same way. Xaml is really our key to that. We don't need to have our own XML dialect to provide a declarative model to developers, we just need to realize that Xaml isn't just a markup language for graphical controls... nor is it solely for Microsoft created frameworks (i.e. WPF, WWF). We too can tap into the beauty of Xaml by simply understanding how simple it is.

In this video I demonstrate how to create a simple data-bound WPF application using Xaml using a C# class to feed the data. Then I alter the WPF application to be purely in Xaml... even the data binding to LLBLGen.

This video is really just a proof of concept of something that I personally consider very experimental at this stage. In the future however, I do expect most WinFX coding to go hand in hand with declarative programming. In fact, you can already see how ASP.NET, Atlas, WPF, WCF (the config file), and WWF are strongly declarative based. Since Xaml is not much more than an XML representation of .NET objects, exposing an API shouldn't be that difficult for us. Most of the time I'm sure a simple framework built with SOA principles in mind should be OK.

Here's the link to download the video:

October 11, 2006 Update

About the time I released the video, the API changed... and for some reason I didn't post this update until just now! So here's an update for it.

In the video I put this at the top of the Xaml file.

<?Mapping XmlNamespace="NorthwindCollections" ClrNamespace="Northwind.DAL.CollectionClasses" Assembly="Northwind.DAL" ?>

That's not how we do things anymore. These days we do this...

<Window x:Class="..."
xmlns="..."
xmlns:x="..."
xmlns:ns="clr-namespace:Northwind.DAL.CollectionClasses;assembly=Northwind.DAL">

Creative Commons License
This work is licensed under a Creative Commons Attribution 2.5 License.

Built on Themelia Pro 2.0

Mini-icons are part of the Silk Icons set of icons at famfamfam.com