Handling the cursor when moving the files using drag drop

0
0

When dragging a file or files if the location is valid example folder the cursor should be changed to move and if not it should show block cursor. This is my code in DragOver event but the cursor is not taking effect.

if (IsValidDropTarget(targetItem))
{
e.Effect = DragDropEffects.Move;
this.Cursor = Cursors.Arrow;
string folderName = GetCleanFolderName(targetItem[“CloudFileName”]?.ToString());
DragVisualHelper.UpdateFloatingLabelWithColor($”Drop into {folderName}”, Color.Brown);
}
else
{
DragVisualHelper.UpdateFloatingLabelWithColor(dragText, Color.AliceBlue);
}

 

  • Ravi Keshwani
    e.Effect = DragDropEffects.Move; this.Cursor = Cursors.Arrow; This code wittent in the DragOver event is not taking effect .. and it always shows not allowed cursor icon when moving the file to folder
  • You must to post comments
0
0

Can you please include a compliable test case? Delete the bin and obj folders before posting.

  • Ravi Keshwani
    No, we cannot share the code due to privacy. The case is very simple. There is a grid which shows the list of folders and files and if the user selects the file wants to move to the area which is allowed e.g. it should be allowed to drag and drop on folders , while the drag is ON the cursor should be not-allowed and when the file is in dragged to the allowed location e.g. a folder the cursor should be changed to arrow. We have written code in the dragOver event provided by wiseJ and the code is triggered but the effect is not visible in the browser and the cursor once set to non-allowed is not changed even though its dragged to allowed location.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.