7

I am working with an application that uses drag and drop operations of grids. The application is backed by a List of objects. When a grid is dropped, the children of the grid(my data) are added to the list. So essentially it is a List but that is not really that important.

Each Grid contains two inner grids. The first grid contains a label, and the second contains a component such as a TextBox, or a DropDown box.(It is a drag and drop editor for building HTML Forms).

I am working on making it easier for the user to see when they drag over the grids if they are going to drop above, below or on the element by checking the position of the mouse while they are dragging over the grid elements.

The problem I am running into is that the DragOver,DragDrop,etc are only firing when I drag over the child elements of the grids. I have tried to go from bubbling to tunneling and vice versa but I cant figure it out.

Is there something I need to set on the Grid Element that allows the entire Grid to accept drops?

1

2 Answers 2

20

Try setting the background of your grids to a transparent brush. In this case I'm not sure if this is the problem, but for most mouse operations such as hit tests, you have to attach a background even if it is transparent.

<Grid Background="Transparent" ... />
1
  • this worked! Thank you, I figured that as long as I was handling the event through the grid, that it would have been fine. Commented Feb 14, 2011 at 21:08
1

In my case, VS and File Explorer were opened with different privilege levels (ie, admin and user), and I could not drag and drop files from the latter to the former.
This post solved it for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.