12
votes

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

1

1 Answers

1
votes

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;