From the course: Windows Presentation Foundation 5: Interaction and Controls

Overview

- [Instructor] In this chapter, we will look at the decorator class, which is a simple class; and they're typically used as some sort of graphical embellishment around an object. Here's the decorator base class. The two classes that we'll look at in examples will be the border class. Its purpose is to draw a four-sided border around an element that typically doesn't have a border. Most often this is used with a panel class of some sort, like a grid. Also, look at the viewbox. The viewbox is used as a wrapper around an element so that you can zoom it in without having to use something more complicated like a render transform. This is typically used with complex shapes, so if you learned how to use the polyline in the shapes chapter or how to work with the path or the polygon, this is a good use. You can wrap those shapes in a viewbox, and it will scale it up or down as necessary. Another decorator that's occasionally used in WPF is the bullet decorator. If you take a look a the decorator class itself, there's really not much to see here. It has one property of interest, which is child; and that just signifies that this can only contain a single child. So you'd create a decorator, and then inside the decorator you can have one child element.

Contents