WPF grid does not work properly for drag and drop

I am working with an application that uses drag and drop operations. The application is supported by a list of objects. When the grid is discarded, the children of the grid (my data) are added to the list. In fact, this is a list, but in fact it is not so important.

Each grid contains two internal lattices. The first grid contains a label, and the second contains a component such as TextBox or DropDown. (This is a drag and drop editor to create HTML forms).

I am working to make it easier for the user to see when they are dragging grids, if they are going to go higher, lower, or onto an element by checking the position of the mouse when they are dragging the grid elements.

The problem I am facing is that DragOver, DragDrop, etc. only shoot when I drag the children of the meshes. I tried to go from bubbling to the tunnel and vice versa, but I can’t figure it out.

Is there something I need to set for a Grid element that allows the entire Grid to accept drops?

+3
source share
1 answer

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

<Grid Background="Transparent" ... />
+11
source

Source: https://habr.com/ru/post/1792088/


All Articles