Edit

Share via


DispatcherTimer.Start Method

Definition

Starts the DispatcherTimer.

public:
 void Start();
public void Start ();
member this.Start : unit -> unit
Public Sub Start ()

Examples

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 1 second using a TimeSpan object.

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

Remarks

Setting IsEnabled to false when the timer is started stops the timer.

Setting IsEnabled to true when the timer is stopped starts the timer.

Start sets IsEnabled to true.

Start resets the timer Interval.

Applies to