O'Reilly logo

Windows Presentation Foundation 4.5 Cookbook by Pavel Yosifovich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating adorners

Adorners are elements that exist in a distinct adorner layer, not part of the normal visual tree. All adorners in a particular layer always sit on top (higher Z index) of the element they adorn. This characteristic of adorners makes them an excellent choice for things such as selection handles, popup elements, and other special tasks where bothering with the normal visual tree is impossible or complicated at best.

In this recipe, we'll take a look at creating and using adorners to indicate selection.

Getting ready

Make sure Visual Studio is up and running.

How to do it...

We'll create an application that draws a bunch of circles that can be dragged with the mouse. The currently selected circle will be marked with an adorner.

  1. Create ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required