Pregunta

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?

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top