mirror of
https://github.com/Stone-Red-Code/docs-desktop.git
synced 2026-09-07 23:43:19 +02:00
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
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
---
|
||||
title: "How to: Implement an Adorner"
|
||||
ms.date: "03/30/2017"
|
||||
dev_langs:
|
||||
- "csharp"
|
||||
- "vb"
|
||||
helpviewer_keywords:
|
||||
- "adorners [WPF], implementing"
|
||||
ms.assetid: 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-csharp[Adorners_SimpleCircleAdorner#_SimpleCircleAdornerBody](~/samples/snippets/csharp/VS_Snippets_Wpf/Adorners_SimpleCircleAdorner/CSharp/Window1.xaml.cs#_simplecircleadornerbody)]
|
||||
[!code-vb[Adorners_SimpleCircleAdorner#_SimpleCircleAdornerBody](~/samples/snippets/visualbasic/VS_Snippets_Wpf/Adorners_SimpleCircleAdorner/VisualBasic/Window1.xaml.vb#_simplecircleadornerbody)]
|
||||
|
||||
## See also
|
||||
|
||||
- [Adorners Overview](adorners-overview.md)
|
||||
Reference in New Issue
Block a user