Question

I want to animate in and out multiple EllipseGeometry in a Windows Store Application using either C# or C++/CX.

I need to do this programmatically because I have an indeterminate number of EllipseGeometry to show each time I execute this animation.

Let's say just for making it more concrete that I need to display those circles inside a Grid.

<Grid x:Name="myGrid" Width="500" Height="500">
</Grid>

Note: There are some answers using XAML but I really need to do this programmatically.

Was it helpful?

Solution

Can't you convert XAML code to C# code?

Something like this:

var storyboard = new Storyboard();

var timeline = new DoubleAnimationUsingKeyFrames
{
    KeyFrames = new DoubleKeyFrameCollection
    {
        new EasingDoubleKeyFrame(0),
        new EasingDoubleKeyFrame(1, KeyTime.FromTimeSpan(new TimeSpan(0, 0, 4)))
    }
};
storyboard.BeginAnimation(OpacityProperty, timeline);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top