From the course: Windows Presentation Foundation 5: Interaction and Controls

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Create drawings with Path

Create drawings with Path

From the course: Windows Presentation Foundation 5: Interaction and Controls

Start my 1-month free trial

Create drawings with Path

- [Instructor] Use the path class when you want to create the most sophisticated shapes including things like Bezier curves and arcs. Here's an example of a path. First thing you want to notice about it is that it is a shape so it support all the properties that we've already discussed like Stroke and StrokeThickness. You can use framework element properties like margin. I could set a fill for this if I wanted to. I can set a fill so you can see the white background through there. In this case, I decided not to use a solid color brush for this stroke so I define a stroke here in this section as a LinearGradientBrush. Then the next step when you're creating a path is to define the data points that are used to draw the shape. And they're inside this area. This is quite some syntax here but let's just point out the key points. On line 33 is the PathFigure. That's how I specify the starting point which is right here at this location. Then I specify a bunch of other elements to put in…

Contents