Wie man das WPF-Pfad in C#

Ich zu kämpfen haben, zu konvertieren, das Stück von WPF-code zu C#. Ich bin relativ neu in WPF, und ich hoffe wirklich, mir kann jemand helfen hier 🙂

    <Path Fill="Blue" Margin="15,15,15,15">
        <Path.Data>
            <EllipseGeometry x:Name="MyAnimatedEllipseGeometry"
                Center="10,100" RadiusX="15" RadiusY="15" />
        </Path.Data>
        <Path.Triggers>
            <EventTrigger RoutedEvent="Path.Loaded">
                <BeginStoryboard Name="MyBeginStoryboard">
                    <Storyboard>

                        <!-- Animates the ellipse along the path. -->
                        <PointAnimationUsingPath
                            Storyboard.TargetName="MyAnimatedEllipseGeometry"
                            Storyboard.TargetProperty="Center"
                            Duration="0:0:5" 
                            RepeatBehavior="Forever" >
                            <PointAnimationUsingPath.PathGeometry>
                                <PathGeometry 
                                    Figures="M 10,100 C 35,0 135,0 160,100 135,0 35,0 10,100"
                                />
                            </PointAnimationUsingPath.PathGeometry>
                        </PointAnimationUsingPath>
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>
        </Path.Triggers>
    </Path>
</Canvas>

Ich schien gut, bis ich die PathGeometry-Zahlen... Wenn jemand liefern kann, der mich mit einem C# code-snippet für das WPF-code, es wird sehr geschätzt werden!

Schreibe einen Kommentar