Export (0) Print
Expand All

PathSegmentCollection Class

Represents a collection of PathSegment objects that can be individually accessed by index.

Namespace: System.Windows.Media
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

[LocalizabilityAttribute(LocalizationCategory.None, Readability=Readability.Unreadable)] 
public sealed class PathSegmentCollection : Animatable, IList, ICollection, IList<PathSegment>, 
	ICollection<PathSegment>, IEnumerable<PathSegment>, IEnumerable
/** @attribute LocalizabilityAttribute(LocalizationCategory.None, Readability=Readability.Unreadable) */ 
public final class PathSegmentCollection extends Animatable implements IList, ICollection, 
	IList<PathSegment>, ICollection<PathSegment>, IEnumerable<PathSegment>, 
	IEnumerable
LocalizabilityAttribute(LocalizationCategory.None, Readability=Readability.Unreadable) 
public final class PathSegmentCollection extends Animatable implements IList, ICollection, 
	IList<PathSegment>, ICollection<PathSegment>, IEnumerable<PathSegment>, 
	IEnumerable
<PathSegmentCollection .../>
<object>
  <object.property>
    oneOrMorePathSegmentObjectElements
  </object.property>
</object>
 oneOrMorePathSegmentObjectElements  One or more PathSegment objects, declared using object element syntax. 

Except as noted, members of this class behave exactly as described by the IList, ICollection, and IEnumerable documentation.

Freezable Features: Because it inherits from the Freezable class, the PathSegmentCollection class provides several special features: PathSegmentCollection objects can be declared as resources, shared among multiple objects, made read-only to improve performance, cloned, and made thread-safe. For more information about the different features provided by Freezable objects, see the Freezable Objects Overview.

This example shows how to create a shape using the PathGeometry class. PathGeometry objects are composed of one or more PathFigure objects; each PathFigure represents a different "figure" or shape. Each PathFigure is itself composed of one or more PathSegment objects, each representing a connected portion of the figure or shape. Segment types include LineSegment, ArcSegment, and BezierSegment.

The following example uses a PathGeometry to create a triangle. The PathGeometry is displayed using a Path element.

<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>
        </PathFigureCollection>
      </PathGeometry.Figures>
    </PathGeometry>
  </Path.Data>
</Path>

The following illustration shows the shape created in the previous example.

A triangle created with a PathGeometry


A PathGeometry

The previous example showed how to create a relatively simple shape, a triangle. A PathGeometry can also be used to create more complex shapes, including arcs and curves. For examples, see Create an Elliptical Arc, Create a Cubic Bezier Curve, and Create a Quadratic Bezier Curve.

This example is part of larger sample; for the complete sample, see the Geometries Sample.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft