문제

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