Skip Navigation LinksHome > View Post

Xaml for Config

I've been working on a pet project recently and been deeply buried in the configuration of System.Diagnostics. Whenever I find myself writing configuration code at the moment my heart angsts to be back playing in a land filled with Xaml. Here's a sample of configuration for System.Diagnostics today:

<?xml version="1.0" encoding="utf-8" ?>
        <source name="MySource" switchValue="All">
                <add name="myListener" />
            <add type="Ukadc.Diagnostics.Listeners.InMemoryTraceListener, Ukadc.Diagnostics" name="myListener">
                <filter type="Ukadc.Diagnostics.Filters.MultiFilter, Ukadc.Diagnostics" initializeData="some, nasty, string, full, of, settings"/>

Now imagine a world of configuration marked up in Xaml...

<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns=""
        <src:InMemoryTraceListener x:Key="myListener">
                <src:MultiFilter Setting1="StronglyTyped" Setting2="Values" />
            <TraceSource x:Name="MySource" SwitchValue="All" Listeners="{StaticResource myListener}" />

Type checking, extensibility... oh the joy. Totally invented on the train home, but it would make me a very happy man.

Tags: Xaml

Josh Post By Josh Twist
1:26 AM
11 Apr 2008

» Next Post: Working with streams
« Previous Post: Invoking a Command on a Double Click (or other 'Mouse Gesture')

Comments are closed for this post.

Posted by David Nelson @ 16 May 2008 3:08 PM
Interestingly, WPF actually makes a lot more sense for application configuration than it does for WPF GUI declaration!

© 2005 - 2015 Josh Twist - All Rights Reserved.