Auto-discovering demos in the Bag of Tricks with MEF and System.Xaml
Back in the old days (sometime in 2005) I built out the Bag of Tricks. At the time, the index of the samples was stored in an XML file. I then used data binding to to connect to the XML, show the items and the descriptions, navigate to the page URLs.
It was very cool…kinda…
Then MEF came along and I realized that having a secondary list of each demo was a bit broken. Each demo should describe itself, right? So I MEF-ized all of the demos that had custom classes by annotating the classes with custom metadata.
It was very cool…but…
I had a bunch of demos that were Xaml-only. Just pages of Xaml that did their thing.
I started the process of creating classes for a bunch of them, but that felt broken. Pages are just xaml. I should be able to use attached properties on each page to specify demo metadata.
Thanks to the work of the Xaml team at MS, we got it done. (Thanks for the email support, Rob.)
Now BOT samples for both Silverlight and WPF use the same mechanism to load samples—although the WPF version gets special support for Xaml-only pages.
Download the latest code on the Source Code page on BOT’s home on Codeplex.