The demo I showed on the MSDN TV segment used an animating star sitting in 3D space as the foreground of text in a RichTextBox. It’s super easy to hook up any WPF visual to be the foreground of your text. Since any text related element takes in a Brush for its foreground, you can set the following:
MyRichTextBox.Foreground = new VisualBrush(*Any WPF Visual including Button, Grid, Canvas*);
The source code is attached to this post. After building, type in some text and then right click and drag the star to change the camera position. You can also zoom in and zoom out using your scroll wheel. VisualBrushes allow you to paint areas with almost any WPF graphical object and are updated live. So as you’re playing with the star sitting in 3D space, your text foreground gets updated live. What’s really cool is that your text is still text. It’s editable, selectable, and is still rendered in our hardware accelerated sub-pixel ClearType regardless of whether you’re using a simple black foreground brush or a VisualBrush.
Yes, this example is a bit gratuitous 🙂 and isn’t exactly great for readability, but it does show you some of the flexibility you get in WPF.
Here’s a good quick overview of VisualBrushes with a coupel samples:
and there’s a full out sample in the Windows SDK under VisualBrush.
The star animation was created by the very talented