#482 – You Can Include Other Controls Inside an InkCanvas

You can use the InkCanvas control as a blank canvas that you can draw on, using the mouse or a stylus.  You can also include child controls in the InkCanvas in the same way that you add child controls to a Canvas.  But with the InkCanvas, the user cannot interact with the controls, but can just scribble over the top of them.

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Label Grid.Row="0" Content="Draw in the area below using your mouse" Margin="10,5"/>
        <Border Grid.Row="1" BorderBrush="DodgerBlue" BorderThickness="2" Margin="10" SnapsToDevicePixels="True">
            <InkCanvas MinHeight="0" MinWidth="0">
                <Label Content="Draw on me" InkCanvas.Left="5" InkCanvas.Right="10"/>
                <Button Content="Me too" InkCanvas.Left="10" InkCanvas.Bottom="10" />
                <Image Source="Images\BestYears.jpg" Height="200" InkCanvas.Right="5" InkCanvas.Top="5"/>
            </InkCanvas>
        </Border>
    </Grid>

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

3 Responses to #482 – You Can Include Other Controls Inside an InkCanvas

  1. Pingback: Dew Drop – January 27, 2012 (#1,252) | Alvin Ashcraft's Morning Dew

  2. jay says:

    Hi,
    i have this situation where InkCanvas more than one (multilayer) and controlled with single control example a button enable and disable editing mode for those all InkCanvas, any idea?

    • Sean says:

      It’s not clear what you’re asking, but I’d recommend you post example code to stackoverflow.com and ask a question there.

Leave a comment