I have been trying to get a border in my wpf application(c#) to flash red and blue when you input the wrong password. my code:
//This method executes when you enter the wrong password
void Alert()
{
Count = 0;
while (Count <= 5)
{
Border_.BorderBrush = Brushes.DarkRed;
//Timer here
Border_.BorderBrush = Brushes.DarkBlue;
//Timer here
Count++;
}
}
I have tried using await
, Thread.Sleep(1000)
, Task.Delay(1000)
and Timers
but nothing worked. I searched for any similar question but could not find any solution that worked for me. (This question didnt work for me either: How to create a Flashing and Normal Background Visual States for a Border control)