From the course: Windows Presentation Foundation: 3 Events and the Event Model

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Use DragEnter to indicate a valid drag target

Use DragEnter to indicate a valid drag target

From the course: Windows Presentation Foundation: 3 Events and the Event Model

Start my 1-month free trial

Use DragEnter to indicate a valid drag target

- [Instructor] At this point in my application, I've got the initial drag operation started, so I can pick one of these images and I can drag it over, but there's no visual indication to the user that this image is a target that they can drop here, so let's fix that. First thing to do is pick your targets. You can have any of your elements be a target, and you have to specify a setting on the target itself. It's called the AllowDrop property. Set that the true, then I'll re-run the application and see if there's any difference. We'll pick up this pastry image, and as I move into the element that I've marked as AllowDrop, you'll see that the cursor automatically changes, so WPF framework is providing this feedback to the user. If this is all you need then you can stop here and go on and write the drop code, but there could be times when you want to change the cursor, maybe pick a different cursor than this one, or maybe you want to have some sort of other visual feedback, so that's…

Contents