Skip to main content
All docs
V25.1
  • DragGridEventArgs.Cursor Property

    Gets or sets the mouse pointer.

    Namespace: DevExpress.XtraGrid.Views.Grid

    Assembly: DevExpress.XtraGrid.v25.1.dll

    NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation

    Declaration

    public Cursor Cursor { get; set; }

    Property Value

    Type Description
    Cursor

    A value that specifies the mouse pointer.

    Remarks

    Use the mouse pointer to give feedback to users during a drag-and-drop operation. For example, if the AllowDrop argument in a DragEnter event handler is set to false, you can use the Cursor property to indicate that the operation is not allowed.

    Example

    This example shows how to prohibit to drop specific data.

    private void dragDropEvents1_DragEnter(object sender, DragEnterEventArgs e) {
        List<TreeListNode> list = e.Data as List<TreeListNode>;
        // You can prohibit to drop specific data.
        if (list.Find((x) => x.GetValue(colDEPARTMENT1).ToString().Contains("Finance")) != null) {
            e.AllowDrop = false;
            e.Cursor = Cursors.No;
            e.Handled = true;
        }
    }
    
    private void dragDropEvents1_DragOver(object sender, DevExpress.Utils.DragDrop.DragOverEventArgs e) {
        List<TreeListNode> list = e.Data as List<TreeListNode>;
        // You can prohibit to drop specific data.
        if (list.Find((x) => x.GetValue(colDEPARTMENT1).ToString().Contains("Finance")) != null) {
            e.Cursor = Cursors.No;
            e.Handled = true;
        }
    }
    

    Note

    Run the XtraTreeList or XtraGrid demo and click Open Solution for more examples.

    The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Cursor property.

    Note

    The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

    See Also