Nasıl yapılır: Bir PathGeometry İçinde Birden Çok Alt Yol Oluşturma
Bu örnekte, bir içinde birden çok alt yol oluşturma ile ilgili bir durum ve daha fazla örnek yer PathGeometry almaktadır. Birden çok alt yol oluşturmak için her alt yol PathFigure için bir oluşturun.
Örnek
Aşağıdaki örnek, her biri bir üçgen olan iki alt yol oluşturur.
<Path Stroke="Black" StrokeThickness="1">
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigureCollection>
<PathFigure IsClosed="True" StartPoint="10,100">
<PathFigure.Segments>
<PathSegmentCollection>
<LineSegment Point="100,100" />
<LineSegment Point="100,50" />
</PathSegmentCollection>
</PathFigure.Segments>
</PathFigure>
<PathFigure IsClosed="True" StartPoint="10,10">
<PathFigure.Segments>
<PathSegmentCollection>
<LineSegment Point="100,10" />
<LineSegment Point="100,40" />
</PathSegmentCollection>
</PathFigure.Segments>
</PathFigure>
</PathFigureCollection>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</Path>
Aşağıdaki örnekte, bir ve XAML özniteliği söz dizimi kullanarak birden çok Path alt yol oluşturma adımları ve ardından aşağıdakiler yer almaktadır. Her M biri yeni bir alt yol oluşturur, böylece örnek her biri bir üçgen çizen iki alt yol oluşturur.
<Path Stroke="Black" StrokeThickness="1"
Data="M 10,100 L 100,100 100,50 Z M 10,10 100,10 100,40 Z" />
(Bu öznitelik söz dizimlerinin aslında bir StreamGeometry ' nin daha hafif bir sürümünü oluşturduğuna dikkat PathGeometry edin. Daha fazla bilgi için Yol Biçimlendirme Söz Dizimi sayfasına bakın.)