Friday, November 11, 2005
My Avalon (WPF) Examples from DevConnections
The Fall DevConnections 2005 has drawn to a close. This was a great conference. I presented 4 different sessions there, one of which was on Avalon (or "Windows Presentation Foundation", I should say...). Since WPF is still a changing technology that's only available as a CTP, many of my examples I did at conferences and user groups earlier this year did not work anymore. Plus, new features are now available, and I of course tried to work many of them into my presentation.
Click here to download the latest version of my examples.
Here are some of the new things in these examples (there is tons of other stuff too):
1) This is a new basic animation example, showing various controls rotating as the mouse moves over them. This example now works completely without code. Everything is done declaratively in XAML. Also, I added a textbox for added effect. Not that it works any different than other controls, but it is kinda cool to start the control rotating by moving the mouse over, and then start typing in a rotating textbox. Not particularly useful, but cool in a geeky way:
2) This example shows the combination of 2D and 3D in a single window. It has a label with a rotating animation behind a textbox. These controls exist in 2D space. Overlapping these controls is a 3D object (the infamous DirectX teapot) which is rotating in 3D space. The teapot is semi-transparent. I like this demo, because it shows that there really isn't much of a difference between 2D and 3D in WPF. Both technologies work very well together. Here's the screen shot:

3) This example shows an area that happens to have a textbox and a button (but you could replace it with anything, really). This "area" exists in 2D space. Below it is a 3D viewport that uses a rectangle (which is positioned in 3D space) to show a real-time reflection of the "area" in 2D viewspace. The reflection is done using a visual brush that is mapped onto the rectangle as a texture. The reflection also uses a gradient opacity mask to create the fading transparency effect:
4) The final example simulates a single item that is for sale in a XAML eCommerce app (ok, that might be a bit of an exaggeration). The main point of this example is that the "item for sale" exists in 3D space and can be rotated to see if from all sides. (Note the nifty real-time reflection below the teapot...) Also, animation is used to show a text panel with more information about the item:
As mentioned above, these are the new things I added. There are quite a number of examples altogether.
Posted @ 8:39 PM by Egger, Markus (markus@code-magazine.com)