Code:
private void button1_Click(object sender, RoutedEventArgs e)
{
bool bolCheck = false;
for (int i = 0; i <= 20; i++)
{
System.Threading.Thread.Sleep(300);
if (bolCheck == true)
{
grid1.Background = new SolidColorBrush(Colors.Black);
bolCheck = false;
}
else
{
grid1.Background = new SolidColorBrush(Colors.White);
bolCheck = true;
}
}
}
private void button1_Click(object sender, RoutedEventArgs e)
{
bool bolCheck = false;
for (int i = 0; i <= 20; i++)
{
System.Threading.Thread.Sleep(300);
if (bolCheck == true)
{
grid1.Background = new SolidColorBrush(Colors.Black);
bolCheck = false;
}
else
{
grid1.Background = new SolidColorBrush(Colors.White);
bolCheck = true;
}
}
}