I like to do simple animation using one Image control in XAML and swaping Source of Image
to other in interval 1 second.
But when I do that, the image is flickering. I using this code (at Tick
event handler of Timer
):
Uri uri = new Uri("ms-appx:/Sprites/Running/" + y++ + ".png",
UriKind.RelativeOrAbsolute);
BitmapImage textureBitmap = new BitmapImage(uri);
this.ImageHolder.Source = textureBitmap;
Where can the problem be ? Should I cache BitmapImages?
Thank you for your help.
Try to declare a StoryBoard in your xaml:
So, you have to add sprites to static resources, and run a StoryBoard.