Partager via


Cursor Class

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Represents the image used for the mouse pointer.

Inheritance Hierarchy

System.Object
  System.Windows.Input.Cursor

Namespace:  System.Windows.Input
Assembly:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
Public NotInheritable Class Cursor
public sealed class Cursor
<object property="cursorName"/>

XAML Values

  • cursorName
    The name of one of the predefined mouse pointer static properties in the Cursors class, or the literal string Default. See Remarks.

 

Name

Description

Default

An element expresses no mouse pointer preference. If the element's parent specifies a mouse pointer, that mouse pointer is displayed.

Arrow

An arrow mouse pointer. This is typically the default mouse pointer.

The Arrow mouse pointer

arrow cursor

Hand

A hand mouse pointer. This shape typically indicates that the mouse pointer is over a link.

The Hand mouse pointer

hand cursor

Wait

A wait (or hourglass) mouse pointer. This mouse pointer typically indicates that the runtime is busy performing an operation.

The Wait mouse pointer

wait cursor

IBeam

An I-beam mouse pointer. This mouse pointer typically indicates that text can be manipulated or selected.

The I-beam mouse pointer

i-beam cursor

Stylus

A stylus mouse pointer. This mouse pointer typically indicates that pen input is being captured.

The Stylus mouse pointer

stylus cursor

Eraser

An eraser mouse pointer. This mouse pointer typically indicates that previous pen input is being deliberately erased.

The Eraser mouse pointer

eraser cursor

None

No mouse pointer is used.

No mouse pointer

no cursor

The Cursor type exposes the following members.

Methods

  Name Description
Public methodSupported by Silverlight for Windows Phone Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows Phone Finalize Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodSupported by Silverlight for Windows Phone GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public methodSupported by Silverlight for Windows Phone GetType Gets the Type of the current instance. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows Phone MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public methodSupported by Silverlight for Windows Phone ToString Returns the string representation of the Cursor. (Overrides Object.ToString().)

Top

Remarks

The Cursors class defines a set of default mouse pointers as static properties. The Cursor class keeps a static value internally. That static value is set either by the system or by specifically setting properties that take a Cursor in XAML or code.

In Silverlight 1.0 or the JavaScript API for Silverlight, the Cursors values are an enumeration (and are actually named MouseCursor). In Silverlight 5 or the managed API, the Cursors values are static property values. In WPF, the cursor/mouse pointer image choice is extensible under full trust. Extensibility for cursors is not enabled in Silverlight 5; you must use the images that correspond to the static property values.

There is no Cursors.Default static property value. Instead, the default cursor is represented in code by setting a Cursor property value to nulla null reference (Nothing in Visual Basic). A value of "Default" is permissible as a XAML attribute usage for this case, mainly to support previous version compatibility. "Default" and "None" are not equivalent.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Other Resources