The ApplicationHelper.DoEvents()
in dt_Tick
probably does nothing, since there are no events to process. At least not the ones you’re probably expecting.
If I’m not mistaken, your code will just quickly set the Radius
to 0
, then 1
, 2
, and so on in quick succession, and finally to 19
. All of that will happen every 500 milliseconds (on every Tick
, that is).
I think you might believe that each Tick
will only set Radius
to one value and then wait for the next Tick
, but it does not. Every Tick
will set the Radius
to all the values, ending at 19
. That is one possible explanation for what you’re experiencing.
I would also like to comment on the DoEvents
approach. It’s most likely a bad idea. Whenever I see a DoEvents
I get chills up my spine. (It reminds me of some seriously bad Visual Basic 5/6 code I stumbled across 10-15 years ago.) As I see it, an event handler should return control of the GUI thread as quickly as possible. If the operation takes a not insignificant amount of time, then you should delegate that work to a worker thread. And nowadays, you have plenty of options for writing asynchronous code.
solved Making smooth effect in WPF manually in C# with DispatcherTimer