Export (0) Print
Expand All

DispatcherTimer.IsEnabled Property

Gets or sets whether the timer is running.

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

public bool IsEnabled { get; set; }
/** @property */
public boolean get_IsEnabled ()

/** @property */
public void set_IsEnabled (boolean value)

public function get IsEnabled () : boolean

public function set IsEnabled (value : boolean)

This property is not typically used in XAML.
<object IsEnabled="bool" .../>

Property Value

true if this timer is enabled; otherwise, false. The default value is false.

IsEnabled must be set to true for the Tick event to be raised.

Calling Start sets IsEnabled to true.

Calling Stop sets IsEnabled to false.

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