Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Silverlight 4 Equivalent to .NET Timer Control

Basically I'm wanting to insert a dynamic clock in my project. Right now I'm using the dateTime control which is fine but it's static. I need the clock to change digits with each second. In c# there is a Timer control that I would be able to use to make this dynamic clock possible. However, in Silverlight 4 I have not been able to locate any kind of Timer Control whatsoever to use in building this dynamic clock.

I didn't know if I was just looking in the wrong place or if it's right under my nose and I'm just missing it or what. Also, I assume using a timer control would be the best, however if there's a better approach to this please let me know that as well.

like image 895
AmbiguousX Avatar asked Jul 14 '10 19:07

AmbiguousX


2 Answers

DispatcherTimer Class

http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatchertimer(VS.95).aspx

for non-UI use you also have the Timer Class

http://msdn.microsoft.com/en-us/library/system.threading.timer(v=VS.95).aspx

like image 186
Jonathan Allen Avatar answered Jan 04 '23 01:01

Jonathan Allen


In case, you are interested in a working demo, you can try the solution from...

http://www.dotnetscraps.com/dotnetscraps/post/Silverlight-e28093-Create-a-binary-clock.aspx

Hope this helps!

like image 23
Rahul Soni Avatar answered Jan 04 '23 01:01

Rahul Soni