开发者

WPF drag and drop to DataGrid

I have been searching the internet high and low but can't find some examples that can help me.

I'm developing an application in wpf, in it I use a DataGrid; each cell has a DataTemplate with and image, in a mosaic style; on the side of the grid I have some tiles to use on the grid.

I'm able to drag the tiles but can't drop them on the grid because I can't find the cell to which make the drop. Is there a way to get a 开发者_如何学编程cell position from the the drag events?

Thanks


I am assuming you suscribed to the drop event on the DataGrid.

Since you have a DataTemplate for each cell, you could subscribe to the drop event from the cell and you should be able to do the modification you want via e.Source.

If you need to you could define a different DataTemplate for each column so that you can figure at the column and then modifiy the data via

BusinessObject row = ((UIElementResponsibleForTeDrop)e.Source).DataContext;
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜