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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top