WPF is the abbreviated "Windows Presentation Foundation". You cannot "add" a timer for a foundation.
Timers already exist you should only use them. There are three types of timers:
System.Threading.Timer
and
System.Timers.Timer
are quite suitable for use with WPF, but
System.Windows.Forms.Timer
is not. Frankly, the last one is not very good even for use with Forms, it's just very well simplified. Don't try to use it and you will be fine. Use first two types instead.
See:
http://msdn.microsoft.com/en-us/library/system.threading.timer.aspx[
^],
http://msdn.microsoft.com/en-us/library/system.timers.timer.aspx[
^].
[EDIT]
Completely forgot about
System.Windows.Threading.DispatcherTimer
, Abhinav reminded us about.
[END EDIT]
Note that I don't believe you really need a timer. In most cases it's much better to use a thread, possible calling
System.Threading.Thread.Sleep
. This approach is usually a good replacement of using the timer; it's more robust and gives you much less trouble.
—SA