Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. WPF Drag Drop - handling DragEnter and DragOver to disallow drop impossible?

WPF Drag Drop - handling DragEnter and DragOver to disallow drop impossible?

Scheduled Pinned Locked Moved WPF
questioncsharpwpfwinformshelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member 1033907
    wrote on last edited by
    #1

    I have the basic drag and drop functionality up and running. Now I want to handle DragEnter and/or DragOver on the drop target and in the event handler decide whether or not the drop is allowed. I thought I would do this by setting DragEventArgs.Effects property to None when the drop is not permitted but this has absolutelly no effect - mouse cursor still looks like everything is ok and indeed Drop event is fired when you drop the item. I remember that this was the way to go in windows forms, how can I conditionally diallow dropping (other that AllowDrop=false of course) in WPF? Edited to add: Straight from MSDN: The drop target is also able to specify what effects it intends in response to the dropped data. For example, if the drop target does not recognize the data type to be dropped, it can refuse the data by setting its allowed effects to None. It typically does this in its DragOver event handler. So where is the problem? I am handling DropOver, settings Effects to None and yet the drop is allowed.

    M 1 Reply Last reply
    0
    • M Member 1033907

      I have the basic drag and drop functionality up and running. Now I want to handle DragEnter and/or DragOver on the drop target and in the event handler decide whether or not the drop is allowed. I thought I would do this by setting DragEventArgs.Effects property to None when the drop is not permitted but this has absolutelly no effect - mouse cursor still looks like everything is ok and indeed Drop event is fired when you drop the item. I remember that this was the way to go in windows forms, how can I conditionally diallow dropping (other that AllowDrop=false of course) in WPF? Edited to add: Straight from MSDN: The drop target is also able to specify what effects it intends in response to the dropped data. For example, if the drop target does not recognize the data type to be dropped, it can refuse the data by setting its allowed effects to None. It typically does this in its DragOver event handler. So where is the problem? I am handling DropOver, settings Effects to None and yet the drop is allowed.

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      You still need to check for drop allow in the Drop event handler and generally do nothing if drop isn't allowed.

      Mark Salsbery :java:

      M 1 Reply Last reply
      0
      • M Mark Salsbery

        You still need to check for drop allow in the Drop event handler and generally do nothing if drop isn't allowed.

        Mark Salsbery :java:

        M Offline
        M Offline
        Member 1033907
        wrote on last edited by
        #3

        Sure, but I want the standard behavior which displays the "no drop" icon (like a stop sign or something) when drop isn't allowed (meaning DragEffect is set to None). This works fine in windows forms and is even documented in WPF but for some reason doesn't work. It's not something I have to implement myself, it's internal Windows behavior, try to drag something somewhere and you'll see for yourself).

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups