Files
docs-desktop/dotnet-desktop-guide/framework/wpf/controls/how-to-create-and-use-a-canvas.md
T
Andy De George da363692ff Initial WPF content migrated (#17)
* Reset branch for WPF changes

* Convert BMP to PNG; fix link-out-of-scope err

* Add snippets for WPF... 6794 files!!!!

* Add missing snippets

* update file updated between migration

* Fix paths to include

* update breadcrumb and toc

* fix index links

* fix index links

* fix index links

* fix markdown
2020-09-04 09:46:28 -07:00

1.7 KiB

title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
title ms.date dev_langs helpviewer_keywords ms.assetid
How to: Create and Use a Canvas 03/30/2017
csharp
vb
controls [WPF], Canvas
Canvas control [WPF], creating
Canvas control [WPF], using
420b9487-9a15-477c-9489-a22a4dec7779

How to: Create and Use a Canvas

This example shows how to create and use an instance of xref:System.Windows.Controls.Canvas.

Example

The following example explicitly positions two xref:System.Windows.Controls.TextBlock elements by using the xref:System.Windows.Controls.Canvas.SetTop%2A and xref:System.Windows.Controls.Canvas.SetLeft%2A methods of xref:System.Windows.Controls.Canvas. The example also assigns a xref:System.Windows.Controls.Control.Background%2A color of LightSteelBlue to the xref:System.Windows.Controls.Canvas.

Note

When you use [!INCLUDETLA#tla_xaml] to position xref:System.Windows.Controls.TextBlock elements, use the xref:System.Windows.Controls.Canvas.Top%2A and xref:System.Windows.Controls.Canvas.Left%2A properties.

[!code-csharpCanvasCode#1] [!code-vbCanvasCode#1]

See also