1

All i want to do is change color of the button triggered on specific moment while mouse is over it. Here is my code which is changing colour when mouse isnt over the button which isnt my goal.

btSubmit.Content = "Get ready!";
await PutDelay(_timeRandomizer.GiveTime());
btSubmit.Background = Brushes.Green; //Here im trying to change the background
btSubmit.Content = "Now!";
_stopwatch.Start();

Here is an example that what i want to achieve

https://www.humanbenchmark.com/tests/reactiontime

Do u have any clues?

fleja
  • 25
  • 4

1 Answers1

1

You can set the event MouseHover to do what you want when the mouse is over for a few seconds on the button. Or you can work with MouseEnter event.

gabemilani
  • 54
  • 1
  • 4
  • This is not exactly what im looking for. I mean how to change this prop in c# after delay is over. – fleja Dec 11 '17 at 19:36
  • Sorry, I did not see the wpf tag. You can work with EventTrigger, Animations and Storyboards in XAML. Take a look at this code: https://stackoverflow.com/a/3736694/6283494 – gabemilani Dec 11 '17 at 23:03