The InkCanvas class represents an InkCanvas in WPF. The code
snippet in Listing 1 creates an InkCanvas at run-time and sets its properties.
private void CreateInkCanvasDynamically()
{
InkCanvas
inkboard = new InkCanvas();
inkboard.Name = "InkBoard";
inkboard.Width = 300;
inkboard.Height = 200;
inkboard.Background = new SolidColorBrush(Colors.LightGray);
inkboard.VerticalAlignment = VerticalAlignment.Top;
inkboard.HorizontalAlignment = HorizontalAlignment.Left;
inkboard.EditingMode = InkCanvasEditingMode.Ink;
inkboard.EditingModeInverted = InkCanvasEditingMode.GestureOnly;
LayoutRoot.Children.Add(inkboard);
}