Swarna Latha
Swarna Latha

Reputation: 1004

To convert line to circle

I'm trying to draw path in WPF with same path Data that I have used in jquery. For this data the output is like a circle in jquery and straight line in WPF. Path data that I used is

public string PathData
        {
            get
            {
                return "M190.97952270507812,97.1241455078125 C190.89520263671875,97.86524200439453 190.72723388671875,99.34707641601562 190.72723388671875,99.34707641601562 C190.72723388671875,99.34707641601562 190.89520263671875,97.86524200439453 190.97952270507812,97.1241455078125 z";
            }
        }

I binded PathData to the Data property of as below.

<Path Data="{Binding PathData}" Stroke="Red" StrokeThickness="2"/>

Actually the path is to draw curves.But in WPF its just a straight line. What is the problem in my path??Is there any way to convert this straight line to curves??

Upvotes: 0

Views: 949

Answers (1)

Gerrit F&#246;lster
Gerrit F&#246;lster

Reputation: 964

Take a look at the documentation for the path markup syntax in WPF.

The C command expects two control points and one endpoint. Since your second control point and your endpoint are identical in both cases, you get a straight line, but no curve.

"M190.97952270507812,97.1241455078125 C190.89520263671875,97.86524200439453 190.72723388671875,99.34707641601562 190.72723388671875,99.34707641601562 C190.72723388671875,99.34707641601562 190.89520263671875,97.86524200439453 190.97952270507812,97.1241455078125 z";

Upvotes: 1

Related Questions