We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Is it possible to change the cursor to tell the user that the cursor area is not available for dropping

I use the ItemDropping event to prevent an item from dropping to certain nodes. However, I can't seem to find a way to change the cursor like the standard TreeView using DragDropEffect enum to indicate if dropping is allowed. I can see that the control will change the cursor to DragDropEffect.None when the mouse is on itself. Is it possible to change the cursor?


3 Replies 1 reply marked as answer

DM Dhanasekar Mohanraj Syncfusion Team December 21, 2022 03:15 PM UTC

Herbert,

We are a little unclear about your scenario. We suspect that your requirement is to change while hovering the cursor for the drag-and-drop restricted item. If yes it will be achievable by using the
ItemDragOver and ItemDropping events are shown below,


private void treeView_ItemDropping(object sender, TreeViewItemDroppingEventArgs e)

{

    var record = e.TargetNode.Content as Model;

    if (record.Header == "Asus")

        e.Handled = true;

}

 

private void treeView_ItemDragOver(object sender, TreeViewItemDragOverEventArgs e)

{

    var record = e.TargetNode.Content as Model;

    if (record.Header == "Asus")

        e.DropPosition = Syncfusion.UI.Xaml.TreeView.DropPosition.None;

}

For more information related to drag-and-drop events, please refer to the below user guide documentation link,


UG Link: https://help.syncfusion.com/wpf/treeview/drag-and-drop#disable-dropping-on-certain-items-in-wpf-treeview

If we misunderstood your requirement, please provide more information regarding the requirement. This would help us to proceed further.


Attachment: SfTreeViewDemo_4ea6e05c.zip

Marked as answer

HE Herbert December 23, 2022 10:07 AM UTC

Yes, this is what I was looking for. Thank you.



DM Dhanasekar Mohanraj Syncfusion Team December 27, 2022 02:01 PM UTC

Herbert,

If you are satisfied with our response, please mark it as an answer. Otherwise, please let us know if you have any further queries on this. We are happy to help you.


Loader.
Live Chat Icon For mobile
Up arrow icon