Sometimes the simplest demos can be the best.
Catherine Heller is our team expert on the myriad of new Windows Vista unmanaged APIs, but she also knows how to get people excited about WPF with less than 100 bytes of code. This is what she typed into a blank file:
<InkCanvas Background=“Yellow“ xmlns=“http://schemas.microsoft.com/winfx/2006/xaml/presentation“ />
Click here to see the results if you’ve got a Beta 2 or more recent build of WPF. This shows off loose XAML running locally in the browser, along with demonstrating how easy it is to add ink support to your WPF application.
Another one line demo I like to do is this (alright, I confess, I’ve wrapped it onto multiple lines to make it easier to show on this blog):
<RichTextBox FontFamily=“Palatino Linotype“ FontSize=“72“
Click here to see the results, and try typing a sentence like this: “The affliction started in 1776 and spread. Quickly!” You’ll notice cool effects like the swash on the Qu, ct, st and sp pairs, as well as the book-style numerals. If you’re particularly eagle-eyed, you might catch the subtle Th ligature that prevents the rightmost descender from the T clashing with the serif of the h, as well as the ffl ligature. If you misspell a word, you’ll see the red wiggly line underneath it – evidence that you get spell checking for “free” with WPF.
What’s the most impressive WPF demo you can construct in a single line of XAML? Can you improve on these?