Files
docs-desktop/dotnet-desktop-guide/framework/wpf/controls/how-to-adorn-the-children-of-a-panel.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: Adorn the Children of a Panel 03/30/2017
csharp
vb
adorners [WPF], binding to children of Panels
Panel control [WPF], binding adorners to children
4cc9b972-b472-4e5c-bdf3-3702d7fbb1f5

How to: Adorn the Children of a Panel

This example shows how to programmatically bind an adorner to the children of a specified xref:System.Windows.Controls.Panel.

Example

To bind an adorner to the children of a xref:System.Windows.Controls.Panel, follow these steps:

  1. Declare a new xref:System.Windows.Documents.AdornerLayer object and call the staticxref:System.Windows.Documents.AdornerLayer.GetAdornerLayer%2A method to find an adorner layer for the element whose children are to be adorned.

  2. Enumerate through the children of the parent element and call the xref:System.Windows.Documents.AdornerLayer.Add%2A method to bind an adorner to each child element.

The following example binds a SimpleCircleAdorner (shown above) to the children of a xref:System.Windows.Controls.StackPanel named myStackPanel.

[!code-csharpAdorners_SimpleCircleAdorner#_AdornChildren] [!code-vbAdorners_SimpleCircleAdorner#_AdornChildren]

Note

Using [!INCLUDETLA#tla_xaml] to bind an adorner to another element is currently not supported.

See also