Files
docs-desktop/dotnet-desktop-guide/framework/wpf/controls/how-to-implement-an-adorner.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.5 KiB

title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
title ms.date dev_langs helpviewer_keywords ms.assetid
How to: Implement an Adorner 03/30/2017
csharp
vb
adorners [WPF], implementing
56ae32b6-0599-455c-b52f-2ff97e6f1ec2

How to: Implement an Adorner

This example shows a minimal adorner implementation.

Notes for Implementers

It is important to note that adorners do not include any inherent rendering behavior; ensuring that an adorner renders is the responsibility of the adorner implementer. A common way of implementing rendering behavior is to override the xref:System.Windows.UIElement.OnRender%2A method and use one or more xref:System.Windows.Media.DrawingContext objects to render the adorner's visuals as needed (as shown in this example).

Example

Description

A custom adorner is created by implementing a class that inherits from the abstract xref:System.Windows.Documents.Adorner class. The example adorner simply adorns the corners of a xref:System.Windows.UIElement with circles by overriding the xref:System.Windows.UIElement.OnRender%2A method.

Code

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

See also