I have a WPF application in C#. When someone touches an image (image1), I want the image to change (image2), delay 2 seconds and finally change to image3.
My code looks like this:
private void ImageName_TouchDown(object sender, TouchEventArgs e)
{
BitmapImage image = new BitmapImage(new Uri("c:/3.jpg", UriKind.Absolute));
ImageName.Source =image;
Thread.Sleep(2000);
image = new BitmapImage(new Uri("c:/4.jpg", UriKind.Absolute));
ImageName.Source = image;
}
I get the delay to work but it seems like c# update only image3 (4.jpg). It is like it cannot update the image source within the event handler. What should I do?