Click here to Skip to main content
11,922,641 members (55,591 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


2 bookmarked

How to Bind an Adorner to an Element?

, 13 Nov 2010 CPOL
Rate this:
Please Sign up or sign in to vote.
Binding an Adorner to an Element
To bind an adorner to a particular UIElement, follow the below mentioned steps.

Call the static method GetAdornerLayer to get an AdornerLayer of object for the UIElement to be adorned. GetAdornerLayer walks up the visual tree, starting at the specified UIElement, and returns the first adorner layer it finds. (If no adorner layers are found, the method returns null).

Call the Add method to bind the adorner to the target UIElement.
The following example binds a SimpleCircleAdorner (shown above) to a TextBox named myTextBox.

myAdornerLayer = AdornerLayer.GetAdornerLayer(myTextBox);
myAdornerLayer.Add(new SimpleCircleAdorner(myTextBox));

Have fun with WPF programming. Enjoy......!

Note:Using Extensible Application Markup Language (XAML) to bind an adorner to another element is currently not supported.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer (Senior) Logitech Engineering & Design (India) Pvt. Ltd.
India India
Venugopal works as a Senior Software Engineer in Logitech Engineering & Design (India) Pvt. Ltd. He hold a Masters in Computer Applications and has 4+ years experience in C#, XAML, Silverlight & WPF.

Venugopal firmly believes "technology is impermanent, change is not"!. While he has strong technical inclination towards MS technologies, he is deeply passionate about pursuing his career in Windows7-WPF and Silverlight Technology.

Venu engages in a wide gamut of temperamental hobbies ranging from making friends, traveling, helping his friends studies. To murmuring songs and watching movies in leisure time.

You may also be interested in...

Comments and Discussions

GeneralReason for my vote of 1 poo Pin
JFergulbops16-Nov-10 3:04
memberJFergulbops16-Nov-10 3:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.151125.1 | Last Updated 13 Nov 2010
Article Copyright 2010 by venugopalm
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid