You’ll need some extra plumbing in your application to read the string of XAML from your file system, database, service, or whatever, but you don’t need much more to create an interactive application that binds to data, displays fancy controls, and runs animations. Of course, that means all the complexity is in the XAML, but the great thing is that rather than have to redeploy your application to enhance it or fix UI issues, you just need to deploy new XAML, which is much manageable.

A few caveats to this: first off, you don’t have a code behind file, and can’t use x:class to specify the class that is going to handle your events. But to be honest, with the data binding capabilities in WPF, you don’t need as much event handling as you might think. Instead of creating event handling code all over the application, create some highly reusable classes that implement the System.Windows.Input.ICommand interface, and use data binding to attach instances of those classes to the objects they need to manipulate.

Here’s an example…just need to create an instance of this SortDescriptionController in the Resources, bind the CollectionViewSource property to a CollectionViewSource that you declaratively add to any collection, set the SortField property to the name of the field to use for sorting, and then bind the Command for any ICommandSource (button, hyperlink, or menuitem) to your instance of the SortDescriptionController, with a Path on the binding pointing to the Sort command. Sure, this is some code, but rather than writing dozens of event handlers everywhere you want sorting, once you have a few controllers for what you need, you can reuse them all over your application.