WinFX Ink: Fun with VisualBrush

Stefan Wick has been having fun with InkCanvas and VisualBrush...  why can't I?

Here's my inspired* attempt at drop-shadow inking in WPF:

http://www.windojitsu.com/code/DropShadowInking.xaml (requires IE6 or later; and WinFX 2006 Feb CTP or later)

<Page

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:ink="clr-namespace:System.Windows.Ink;assembly=PresentationCore">

 

  <Grid Background="Beige">

 

    <Canvas>

      <Canvas.Background>

        <VisualBrush

          Visual="{Binding ElementName=inkCanvas1}"

          Transform="1,0,0,1,5,5" Opacity="0.50" />

      </Canvas.Background>

    </Canvas>

 

    <InkCanvas Name="inkCanvas1" Background="Transparent">

      <InkCanvas.DefaultDrawingAttributes>

        <ink:DrawingAttributes Color="Black" Width="5" Height="5" />

      </InkCanvas.DefaultDrawingAttributes>

    </InkCanvas>

 

  </Grid>

 

</Page>

*inspired by Charles Petzold's persistent quest for the Real-Time Drop-Shadow.

A couple of things to note: the new XML namespaces for WPF and XAML -- and the new "clr-namespace" URI syntax for mapping CLR to XML.  (These will take effect in the forthcoming Feb CTP.)

Updated: Fri, 03 Feb 2006 06:06:34 GMT