Skip to main content
Home Forums Silverlight Programming Report a Silverlight Bug DispatcherTimer doesn't allow event subscription after timer is started
2 replies. Latest Post by fkruesch on March 27, 2008.
(0)
fkruesch
Member
38 points
22 Posts
03-25-2008 5:21 PM |
In the following code snippet. the _timer_Tick event will never be called. ObviouslySilverlight doesn't allow to subscribe to a DispatcherTimer once it runs. _timer = new DispatcherTimer();_timer.Interval = TimeSpan.FromSeconds(0.5); _timer.Start();_timer.Tick += new EventHandler(_timer_Tick);
In the following code snippet. the _timer_Tick event will never be called. ObviouslySilverlight doesn't allow to subscribe to a DispatcherTimer once it runs.
_timer =
This is quite confusing until you figure it out...Florian
Allen Ch...
Star
13662 points
1,780 Posts
03-27-2008 4:24 AM |
Hi:
Thanks for reproting this issue and sorry for confusing you so much. But it's by design and from the msdn we can see the example also attach the event before calling Start method:
http://msdn2.microsoft.com/en-us/library/system.windows.threading.dispatchertimer.aspx
However it's very kind of you to point it out, which may save other's time.
Thanks again.
03-27-2008 6:37 AM |
It is confusing, because in WPF proper you can attach an event handler once the timer is running!