开发者

WPF Grid not working properly for drag and drop

开发者 https://www.devze.com 2023-02-10 23:59 出处:网络
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

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开发者_如何学Go 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?


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" ... />
0

精彩评论

暂无评论...
验证码 换一张
取 消