Chapter 8. Two-Dimensional Drawing Controls

Chapter 5, "Content Controls," describes controls that display information to the user. Most of these controls display textual data or images.

This chapter describes controls that display more graphical output: two-dimensional (2D) drawing controls. These controls draw lines, ellipses, curves, and other 2D shapes.

This chapter also describes the Path mini-language that you can use to concisely make the Path object produce complex drawings.

Control Overview

The following table briefly lists the controls described in this chapter together with their purposes. You can use this table to help decide which control to use to satisfy your needs.

Control

Purpose

Ellipse

Draws an ellipse.

Line

Draws a line.

Path

Draws a series of lines and curves.

Polygon

Draws a series of line segments that connect a series of points. It finishes by connecting the last point to the first.

Polyline

Draws a series of line segments that connect a series of points.

Rectangle

Draws a rectangle.

Stroke Properties

The controls described in this chapter draw linear features. Whether they draw a single line segment, a closed ellipse, or a complex sequence of curves, lines, and polygons, they all basically draw lines.

WPF provides a special set of properties to control the way those lines are drawn. These properties control the lines' colors, dash style, and thickness.

The following table summarizes these controls' most important drawing properties:

Property

Purpose

Fill

The control's background ...

Get WPF Programmer's Reference: Windows Presentation Foundation with C# 2010 and .NET 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.