Path
All the preceding shapes are just special cases of a powerful shape called Path
. Path
adds only a single Data
property to Shape
, which can be set to an instance of any geometry, for example:
<Path StrokeThickness="10" Fill="Red"> <Path.Data> <RectangleGeometry Rect="0,0,100,100"/> </Path.Data> </Path>
Path
made its first appearance in C# code back in Chapter 5, “Handling Input: Touch, Mouse, Pen, and Keyboard,” for rendering ink strokes. This C# code revealed much more about geometries than the preceding XAML snippet, but geometries are covered in the next section. First, let’s look at a number of ways to alter the appearance of any shape’s strokes.
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.