Silverlight PathGeometry in VB.NET

In this article you will learn how to work with PathGeometry in Silverlight.
  • 2027

HTML clipboardThe PathGeometry object and the geometry mini-language provide the means to describe multiple complex figures that are composed of arcs, curves, and lines. At the heart of a PathGeometry is a collection of PathFigure objects, so named because each figure describes a discrete shape in the PathGeometry. Each PathFigure is itself composed of one or more PathSegment objects, each of which describes a segment of the figure.

Example of PathGeometry

<UserControl x:Class="SilverlightApplication2.MainPage"
    xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' 
    xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
    xmlns:d='http://schemas.microsoft.com/expression/blend/2008' 
    xmlns:mc='http://schemas.openxmlformats.org/markup-compatibility/2006' 
    mc:Ignorable='d' 
    d:DesignWidth='640' 
    d:DesignHeight
='480'>
    <Grid x:Name="LayoutRoot" Background="White">
        <Canvas Width="200" Height="200" Background="Yellow">
            <Path Stroke="Pink" StrokeThickness="4">
                <Path.Data>
                    <PathGeometry>
                        <PathGeometry.Figures>
                            <PathFigure StartPoint="5,5">
                                <PathFigure.Segments>
                                    <ArcSegment Size="20,20" RotationAngle="40" Point="30,20"IsLargeArc="False" SweepDirection="Clockwise" />
                                    <BezierSegment Point1="60,10" Point2="60,60" Point3="85,90"/>
                                    <LineSegment Point="80,15" />
                                    <PolyLineSegment Points="70,100 6,7" />
                                    <QuadraticBezierSegment Point1="90,90" Point2="70,60"/>
                                </PathFigure.Segments>
                            </PathFigure>
                        </PathGeometry.Figures>
                    </PathGeometry>
                </Path.Data>
            </Path>
        </Canvas>
    </Grid>
</
UserControl>

Output Window

s.gif
 

Conclusion

Hope this article help you to understand how to work with PathGeometry in Silverlight.

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.