Silverlight 4 相当于 .NET 计时器控件
基本上我想在我的项目中插入一个动态时钟。现在我正在使用 dateTime 控件,它很好,但它是静态的。我需要时钟每秒改变数字。在 c# 中,有一个 Timer 控件,我可以使用它来使这个动态时钟成为可能。然而,在 Silverlight 4 中,我无法找到任何类型的计时器控件来构建这个动态时钟。
我不知道我是否只是看错了地方,或者它就在我眼皮子底下而我只是错过了还是什么。另外,我认为使用计时器控件是最好的,但是如果有更好的方法,也请告诉我。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
DispatcherTimer 类
http://msdn .microsoft.com/en-us/library/system.windows.threading.dispatchertimer(VS.95).aspx
对于非 UI 使用,您还拥有 Timer 类
http://msdn.microsoft.com/en-us/library/system .threading.timer(v=VS.95).aspx
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
如果您对工作演示感兴趣,您可以尝试以下解决方案...
http://www.dotnetscraps.com/dotnetscraps/post/Silverlight-e28093-Create-a-binary-clock.aspx
希望这有帮助!
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!