C# WPF PathGeometry在DoubleAnimationUsingPath中被替换

C# WPF PathGeometry在DoubleAnimationUsingPath中被替换,c#,wpf,path,pathgeometry,doubleanimation,C#,Wpf,Path,Pathgeometry,Doubleanimation,所以我是WPF的新手,根本不知道为什么这不起作用。我想在椭圆上做一个双路径动画。所以我使用了PathObject来简单地找出我需要的PathGeometry图形 <Path Stroke="Black" StrokeThickness="5"> <Path.Data> <PathGeometry Figures="M 200,100 C 307,180 390, 180 500,190"></PathGeometry>

所以我是WPF的新手,根本不知道为什么这不起作用。我想在椭圆上做一个双路径动画。所以我使用了PathObject来简单地找出我需要的PathGeometry图形

<Path Stroke="Black" StrokeThickness="5">
    <Path.Data>
        <PathGeometry Figures="M 200,100 C 307,180 390, 180 500,190"></PathGeometry>
    </Path.Data>
 </Path>

但现在,当我在PathAnimation中使用这些图形时,如下所示:

<Storyboard>
    <!-- The X-axis animation -->
    <DoubleAnimationUsingPath Name="aniX21"
        Storyboard.TargetName="exportTarget21"
        Storyboard.TargetProperty="X"
        Source="X"
        Duration="0:0:03"
        RepeatBehavior="Forever"
        AutoReverse="False">
        <DoubleAnimationUsingPath.PathGeometry>
            <PathGeometry Figures="M 200,100 C 307,180 390, 180 500,190"/>
        </DoubleAnimationUsingPath.PathGeometry>
    </DoubleAnimationUsingPath>
    <DoubleAnimationUsingPath Name="aniY21"
        Storyboard.TargetName="exportTarget21"
        Storyboard.TargetProperty="Y"
        Source="Y"
        Duration="0:0:03"
        RepeatBehavior="Forever"
        AutoReverse="False">
        <DoubleAnimationUsingPath.PathGeometry>
            <PathGeometry Figures=" M 200,100 C 307,180 390, 180 500,190" />
        </DoubleAnimationUsingPath.PathGeometry>
    </DoubleAnimationUsingPath>


动画可以工作,但只有x坐标是正确的。y坐标完全移位

呵呵,sry是我的第一篇文章,代码块不起作用(x)请准确。证明这一点可以可靠地证明问题。详细、准确地解释代码示例的作用,以及它的作用与您想要的不同之处。另见