Files
docs-desktop/dotnet-desktop-guide/framework/wpf/controls/how-to-adorn-the-children-of-a-panel.md
T
Andy (Steve) De George be103da07e Replace various WPF include files with content (#1335)
* net-current-v30plus-md.md

* net-current-v40plus-md.md

* tla2sharptla-ui-md.md

* tla2sharptla-uiautomation-md.md

* tla2sharptla-winclient-md.md

* tla2sharptla-xaml-md.md

* tlasharptla-ui-md.md

* tlasharptla-uiautomation-md.md

* tlasharptla-winclient-md.md

* tlasharptla-xaml-md.md

* fix warnings
2022-03-16 12:14:11 -04: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 Extensible Application Markup Language (XAML) to bind an adorner to another element is currently not supported.

See also