XAML InkCanvas

This article demonstrates how to use InkCanvas XAML element.
  • 3757

InkCanvas

The InkCanvas is the primary control used in drawing Ink in WPF applications. An InkCanvas control defines an area that is used as a drawing board for Ink. Usually a pen or mouse is used to draw on an InkCanvas that interacts with a digitizer to produce ink strokes. The InkCanvas element in XAML represents an InkCanvas.  

  <InkCanvas />

In WPF, the InkCanvas class represents an InkCanvas control. Similar to other WPF classes, the InkCanvas class is inherited from UIElement and FrameworkElement classes and that means it has all properties such as Name, Width, Height, Background, Foreground and so. The following code snippet sets some of these properties in XAML at design-time.

<InkCanvas Name="InkBoard" Width="300" Height="200"
 Background="LightBlue" Margin="10,10,0,0"
 VerticalAlignment="Top" HorizontalAlignment="Left" >
</InkCanvas>

Let's write a simple Ink application.
Create a WPF application in Visual Studio and place this InkCanvas code within the Grid element.

 <Grid>
<InkCanvas Name="InkBoard" Width="300" Height="200" 
Background="LightBlue" Margin="10,10,0,0"
VerticalAlignment="Top" HorizontalAlignment="Left" >
</InkCanvas>
</Grid>

  Further Readings

You may also want to read these related articles.  

Ask Your Question 

Got a programming related question? You may want to post your question here
© 2020 DotNetHeaven. All rights reserved.