Esta documentación está archivada y no tiene mantenimiento.

FrameworkElement.Cursor (Propiedad)

Gets or sets the cursor that displays when the mouse pointer is over this element. This is a dependency property.

Espacio de nombres: System.Windows
Ensamblado: PresentationFramework (en presentationframework.dll)
Espacio de nombres XML:

public Cursor Cursor { get; set; }
/** @property */
public Cursor get_Cursor ()

/** @property */
public void set_Cursor (Cursor value)

public function get Cursor () : Cursor

public function set Cursor (value : Cursor)

<object Cursor="Cursor" .../>

Valor de propiedad

The cursor to display. The default value is defined as referencia null (Nothing en Visual Basic) per this dependency property. However, the practical default at runtime will come from a variety of factors.

Identifier field


Metadata properties set to true


When you set this property in XAML, the XAML reader relies on type conversion for the Cursor class to evaluate the string. The provided string should evaluate to a CursorType value. See Cursor for details.

Whether the cursor as established by this property will or will not display when the mouse pointer is over this element is also dependent on the value of the ForceCursor property. Also, event-related considerations such as an active drag, mouse capture, text editing modes within controls, and so on, will also affect the cursor with higher priority than the value you specify in this property.

To revert the behavior of setting this property to the eventual default, set it to referencia null (Nothing en Visual Basic) again.

The referencia null (Nothing en Visual Basic) default really means that determination of the practical cursor value is deferred here and should be obtained from elsewhere. If presented without programatic values from any source, the default cursor that is visually over a Windows Presentation Foundation (WPF) application will be an arrow. However, the transient cursor changes are not set to the Cursor values of the elements when they are passed over. The Cursor property will only report non null values in cases where it was actually set, for instance through code or a style. Each movement of the mouse over a WPF application raises a QueryCursor event. The event bubbles, and any element along the route has the opportunity to handle the event and to set the value of the cursor through the arguments of this event. This is the mechanism that produces the visually apparent cursor in most cases. If a QueryCursor handler returns a cursor result, then the fact that the event is handled and has a changed value in the arguments takes precedence over the value of the Cursor property at any level, unless ForceCursor is set.

If not are not creating a custom cursor, you typically set this property to a static property value of the Cursors class. Setting Cursor in code requires one of the following:

  • Call the Cursor constructor to get a Cursor instance. Both signatures of the Cursor constructor use streams or files, in anticipation that you are creating the Cursor object for a custom cursor.

  • Use the CursorConverter class and its ConvertFrom method to specify a cursor by CursorType, or a string that can evaluate to a CursorType, and cast the return to Cursor.

Setting the Cursor to a custom value is not enabled in partial trust. For more information on custom cursors, see Input Overview.

The following example shows how to deliberately set the cursor graphic.

public void CursorTypeChanged(object sender, SelectionChangedEventArgs e)
    ComboBox source = e.Source as ComboBox;

    if (source != null)
        ComboBoxItem selectedCursor = source.SelectedItem as ComboBoxItem;

        // Changing the cursor of the Border control 
        // by setting the Cursor property
        switch (selectedCursor.Content.ToString())
            case "AppStarting":
                DisplayArea.Cursor = Cursors.AppStarting;
            case "ArrowCD":                        
                DisplayArea.Cursor = Cursors.ArrowCD;
            case "Arrow":
                DisplayArea.Cursor = Cursors.Arrow;
            case "Cross":
                DisplayArea.Cursor = Cursors.Cross;
            case "HandCursor":
                DisplayArea.Cursor = Cursors.Hand;
            case "Help":
                DisplayArea.Cursor = Cursors.Help;
            case "IBeam":
                DisplayArea.Cursor = Cursors.IBeam;
            case "No":
                DisplayArea.Cursor = Cursors.No;
            case "None":
                DisplayArea.Cursor = Cursors.None;
            case "Pen":
                DisplayArea.Cursor = Cursors.Pen;
            case "ScrollSE":
                DisplayArea.Cursor = Cursors.ScrollSE;
            case "ScrollWE":
                DisplayArea.Cursor = Cursors.ScrollWE;
            case "SizeAll":
                DisplayArea.Cursor = Cursors.SizeAll;
            case "SizeNESW":
                DisplayArea.Cursor = Cursors.SizeNESW;
            case "SizeNS":
                DisplayArea.Cursor = Cursors.SizeNS;
            case "SizeNWSE":
                DisplayArea.Cursor = Cursors.SizeNWSE;
            case "SizeWE":
                DisplayArea.Cursor = Cursors.SizeWE;
            case "UpArrow":
                DisplayArea.Cursor = Cursors.UpArrow;
            case "WaitCursor":
                DisplayArea.Cursor = Cursors.Wait;
            case "Custom":
                DisplayArea.Cursor = CustomCursor;

        // If the cursor scope is set to the entire application
        // Use OverrideCursor to force the cursor for all elements
        if (cursorScopeElementOnly == false)
            Mouse.OverrideCursor = DisplayArea.Cursor;

Microsoft .NET Framework 3.0 es compatible con Windows Vista, Microsoft Windows XP SP2 y Windows Server 2003 SP1.

.NET Framework

Compatible con: 3.0