Domanda

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?

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top