Using Ink in 3-D with Windows Presentation Foundation


Stefan Wick
Microsoft Corporation

January 2006, updated March 2006

Applies to:
   Microsoft Windows Vista
   Tablet PC
   WinFX SDK for the WinFX Runtime Components February 2006 CTP

Summary: In February 2006, Microsoft released a Community Technology Preview of Windows Presentation Foundation (formerly code-named "Avalon"), the new presentation subsystem for Windows that unifies development of documents, graphics, and applications into a common platform. The InkCanvas element in this new platform is your "one-stop shopping" solution for collecting and rendering ink inside of applications designed for Windows Presentation Foundation. (2 printed pages)

Click here to download the sample code for this article.

The Sample

To show some of the powerful features of Windows Presentation Foundation, I have put together a sample that demonstrates the InkCanvas element in combination with other exciting features such as 3-D graphics, animations, and VisualBrushes. A VisualBrush is a very versatile and powerful brush that paints an area with a Visual. A Visual is a low-level graphical object that serves as the foundation of many useful graphical components. For example, the Window, FrameworkElement, and Control classes are all types of visuals. In the sample application, the front and the back side of a rectangular 3-D geometry are painted by using VisualBrushes that are associated with two InkCanvas controls. This simulates a postcard in 3-D space that enables handwriting and editing (select, erase) of the ink on either side of the paper. Each interaction with the 2-D InkCanvas controls is reflected immediately in the 3-D object. The following illustration shows the UI for the sample application.

Figure 1. Screenshot of the 3-D postcard showing handwriting.