Skip to content

Latest commit

 

History

History
25 lines (18 loc) · 2.13 KB

how-to-data-bind-to-an-inkcanvas.md

File metadata and controls

25 lines (18 loc) · 2.13 KB
title ms.date helpviewer_keywords ms.assetid description
How to: Data Bind to an InkCanvas
03/30/2017
InkCanvas [WPF], binding data to
binding data [WPF], to InkCanvas
8d6b4d9e-ea7f-4412-ba83-3feccec5a515
Learn how to data bind the Strokes property of an InkCanvas to another InkCanvas and how to bind a DefaultDrawingAttributesProperty to a data source.

How to: Data Bind to an InkCanvas

Example

The following example demonstrates how to bind the xref:System.Windows.Controls.InkCanvas.Strokes%2A property of an xref:System.Windows.Controls.InkCanvas to another xref:System.Windows.Controls.InkCanvas.

[!code-xamlInkCanvasBindingSnippet#2]

The following example demonstrates how to bind the xref:System.Windows.Controls.InkCanvas.DefaultDrawingAttributes%2A property to a data source.

[!code-xamlInkCanvasBindingSnippet#3]
[!code-xamlInkCanvasBindingSnippet#4]

The following example declares two xref:System.Windows.Controls.InkCanvas objects in XAML and establishes data binding between them and other data sources. The first xref:System.Windows.Controls.InkCanvas, called ic, is bound to two data sources. The xref:System.Windows.Controls.InkCanvas.EditingMode%2A and xref:System.Windows.Controls.InkCanvas.DefaultDrawingAttributes%2A properties on ic are bound to xref:System.Windows.Controls.ListBox objects, which are in turn bound to arrays defined in the XAML. The xref:System.Windows.Controls.InkCanvas.EditingMode%2A, xref:System.Windows.Controls.InkCanvas.DefaultDrawingAttributes%2A, and xref:System.Windows.Controls.InkCanvas.Strokes%2A properties of the second xref:System.Windows.Controls.InkCanvas are bound to the first xref:System.Windows.Controls.InkCanvas, ic.

[!code-xamlInkCanvasBindingSnippet#1]