I have written this code in C# for WP7 :
public void btn_handler(object sender, EventArgs args)
{
Button btn_Pressed = (Button)sender;
ImageBrush br = new ImageBrush();
br.ImageSource = new BitmapImage(new Uri("/images/cat.png"
, UriKind.Relative));
btn_Pressed.Background = br;
Thread.Sleep(5000);
SolidColorBrush sBrush = new SolidColorBrush();
sBrush.Color = System.Windows.Media.Colors.White;
btn_Pressed.Background = sBrush;
}
Whenever the user clicks the button, I want the background of the button to change to an image. After about 5 secs, I want the background to change back to White. Currently, the program doesnt change the background image of the button, it waits for 5 secs and directly changes the background to White.
I am a noob to WP. I tried searching for a solution and what I got was to create a DispatcherThread but I didnt understand how to proceed. Please help :(