Files
docs-desktop/dotnet-desktop-guide/framework/wpf/controls/how-to-use-the-attached-properties-of-canvas-to-position-child-elements.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.9 KiB

title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
title ms.date dev_langs helpviewer_keywords ms.assetid
How to: Use the Attached Properties of Canvas to Position Child Elements 03/30/2017
csharp
vb
cpp
attached properties [WPF Designer]
Canvas control [WPF], attached properties
48f1d25d-3820-4107-a4cc-d6c1e5664a44

How to: Use the Attached Properties of Canvas to Position Child Elements

This example shows how to use the attached properties of xref:System.Windows.Controls.Canvas to position child elements.

Example

The following example adds four xref:System.Windows.Controls.Button elements as child elements of a parent xref:System.Windows.Controls.Canvas. Each element is represented by a xref:System.Windows.Controls.Canvas.Bottom%2A, xref:System.Windows.Controls.Canvas.Left%2A, xref:System.Windows.Controls.Canvas.Right%2A, and xref:System.Windows.Controls.Canvas.Top%2A. Each xref:System.Windows.Controls.Button is positioned relative to the parent xref:System.Windows.Controls.Canvas and according to its assigned property value.

[!code-cppCanvasAttachedProperties#1] [!code-csharpCanvasAttachedProperties#1] [!code-vbCanvasAttachedProperties#1]

See also