Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我希望为Lineusing设置动画PointAnimation,但发现线的端点不是依赖属性,个体X和Y组件是。
Line
PointAnimation
X
Y
是否可以子类化Line,为端点添加依赖属性(例如P1,P2),然后使用 为此类的实例设置动画PointAnimation?
P1
P2
您可以创建一条线作为路径:
<Path Stroke="Black" StrokeThickness="1"> <Path.Data> <LineGeometry x:Name="line" StartPoint="0,0" EndPoint="100,100"/> </Path.Data> </Path>
现在您可以为 LineGeometry 的 StartPoint 和 EndPoint 属性设置动画。