12.1. Understanding Shapes

The simplest way to draw 2-D graphical content in a WPF user interface is to use shapes—dedicated classes that represent simple lines, ellipses, rectangles, and polygons. Technically, shapes are known as drawing primitives. You can combine these basic ingredients to create more complex graphics.

The most important detail about shapes in WPF is that they all derive from FrameworkElement. As a result, shapes are elements. This has a number of important consequences:

  • Shapes draw themselves. You don't need to manage the invalidation and painting process. For example, you don't need to manually repaint a shape when content moves, the window is resized, or the shape's properties change.

  • Shapes are organized in the same way ...

Get Pro WPF in C# 2010: Windows Presentation Foundation in .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.