* 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
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 |
|
|
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:
-
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. -
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.