O'Reilly logo

XAML Unleashed by Adam Nathan

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

Representing Geometries as Strings

Representing each segment in a Geometry with a separate element is fine for simple shapes and paths or geometries formed dynamically in procedural code. For complicated artwork in XAML, however, it can get extremely verbose. Although most people use a design tool to emit XAML-based geometries anyway rather than craft them by hand, it makes sense to keep the resultant file size as small as reasonably possible.

Therefore, XAML supports a flexible syntax for representing just about any PathGeometry as a string. The PathGeometry representing the simple triangle displayed in Figure 7.11:

<Path Fill="Orange" Stroke="Black" StrokeThickness="10">  <Path.Data>    <PathGeometry>       <

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