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 C#. For complicated artwork in XAML, however, it can get extremely verbose. Although most people use a design tool to emit XAML-based geometries 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 15.11:
<Path Fill="Orange" Stroke="Black" StrokeThickness="10"> <Path.Data> < PathGeometry > < PathFigure IsClosed ...
Get Universal Windows® Apps with XAML and C# Unleashed 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.