Drag & Drop
Hi Dapfor Team,
I used the Dapfor version 2.4 and implemented the Drag&Drop functionality like:
Grid grid = new Grid();
grid.DragEnter += MyDragEnter;
grid.DragDrop += MyDragDrop;
I updated to Dapfor version 2.5.1 and now it doesnt work anymore. I know there is a special Drag&Drop support included since 2.5. and i think i should use the DragEnterContent and DragDropContent events. But the DragContentEventArgs doesnt contain the properties KeyState, X and Y which i needed for my implementation. How can i solve this problem?
-
Hi,
Here is a code demonstrating how to get X, Y location and key state in the DragContentEventArgs object:
Point point = e.TargetGrid.PointToClient(Cursor.Position);
Keys keys = Control.ModifierKeys;But you are right, we don't call base.OnDragDrop() in grid's overridden methods. We will fix it and also provide properties to get X, Y, and KeyState in the DragContentEventArgs class.
Therefore the DragContentEventArgs object provides target grid, target row and also position where the data is inserted. Moreover in the e.Data property you can find IDataObject which provides clipboard information with available clipboard formats.
Best regards,
0 -
I tried to use the DragEnterContent and DragDropContent, but it doesnt work for me. I just want to drop some data into the grid, but the DragDropEffects are always "None" and the DragDropContent event is not fired.
I attach a sample project of my problem.
WindowsFormsApplication1.zip0 -
Hi Sten,
You get the 'None' effect because you don't handle m_Grid.DragOverContent event. Just add
this.m_Grid.DragOverContent += new EventHandler<DragContentEventArgs>(MyDragEnterContent);
and your example will work. In attachments you will find a fixed example.
Regards,
The Dapfor Team
WindowsFormsApplication1.zip0 -
Thanks! very good support!
0
Please sign in to leave a comment.
Comments
4 comments