Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Interval Property
Collapse the table of content
Expand the table of content

DispatcherTimer.Interval Property

Gets or sets the period of time between timer ticks.

Namespace: System.Windows.Threading
Assembly: WindowsBase (in windowsbase.dll)

public TimeSpan Interval { get; set; }
/** @property */
public TimeSpan get_Interval ()

/** @property */
public void set_Interval (TimeSpan value)

public function get Interval () : TimeSpan

public function set Interval (value : TimeSpan)

You cannot use this property in XAML.

Property Value

The period of time between ticks. The default value is 00:00:00.

Exception typeCondition

ArgumentOutOfRangeException

interval is less than zero or greater than MaxValue.

Timers are not guaranteed to execute exactly when the time interval occurs, but are guaranteed to not execute before the time interval occurs. This is because DispatcherTimer operations are placed on the Dispatcher queue like other operations. When the DispatcherTimer operation executes is dependent on the other jobs in the queue and their priorities.

The following example creates a DispatcherTimer. A new DispatcherTimer object named dispatcherTimer is created. The event handler dispatcherTimer_Tick is added to the Tick event. The Interval is set to one second using a TimeSpan object.

//  DispatcherTimer setup
dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
dispatcherTimer.Interval = new TimeSpan(0,0,1);
dispatcherTimer.Start();

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2015 Microsoft