* 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
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 Extensible Application Markup Language (XAML) to bind an adorner to another element is currently not supported.