DispatcherTimer.Interval Property
Silverlight
Gets or sets the amount of time between timer ticks.
Namespace: System.Windows.Threading
Assembly: System.Windows (in System.Windows.dll)
| Exception | Condition |
|---|---|
| ArgumentOutOfRangeException | The specified value when setting this property represents a negative time interval. |
The following code example demonstrates how to use this property.
private void TestDispatcherTimer(Panel counterPanel) { DispatcherTimer timer = new DispatcherTimer(); int counter = 0; counterPanel.MouseLeftButtonDown += delegate(object s, MouseButtonEventArgs args) { if (timer.IsEnabled) timer.Stop(); else timer.Start(); }; timer.Tick += delegate(object s, EventArgs args) { counterPanel.Children.Clear(); counterPanel.Children.Add( new TextBlock { Text = counter++.ToString() }); }; timer.Interval = new TimeSpan(0, 0, 1); // one second timer.Start(); }
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.