Question

I was hoping to animate a Line using PointAnimation, but discovered that the endpoints of the line are not dependency properties, the individual X and Y components are.

Would it be possible to subclass Line, adding dependency properties for the endpoints (e.g. P1, P2) and then animate instances of this class with PointAnimation?

Was it helpful?

Solution

You could create a Line as a Path:

<Path Stroke="Black" StrokeThickness="1">
    <Path.Data>
        <LineGeometry x:Name="line" StartPoint="0,0" EndPoint="100,100"/>
    </Path.Data>
</Path>

Now you could animate the StartPoint and EndPoint properties of the LineGeometry.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top