Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
85
Drag and drop: drag from Option-field and drop on Datagrid-Cell
posted

Hi Forum, hi IG-Team,

I'm just starting with xamDatagrids. I stumble with "Drag and Drop" and to fire a trigger on DG-Cell.

So, what is my task?
I'd like to drag a label from option-field and drop on Datagrid-Cell. After dropping on DG-Cell, the Label content should be accept by the cell.
As I wrote above, I stumple with dropping on Datagrid-Cell.
Is there any example?

best regards Alex

  • 34430
    Verified Answer
    Offline posted

    Hello Alex,

    In order to achieve drag and drop functionality to the XamDataGrid, I would recommend using the Infragistics Drag and Drop Framework, which you can read about here: https://www.infragistics.com/help/wpf/drag-and-drop-framework.

    This can be achieved by placing a DragDropManager.DragSource on your "options panel" elements that you wish to drag, and writing a Style for CellValuePresenter that sets the DragDropManager.DropTarget. If you then apply this style to the CellValuePresenterStyle property of the Field element that you wish to drop onto, each of those cells for that particular Field will become a "drop target" for your drag operation.

    By handling the "Drop" event on the DragSource that you place on your "options panel" elements, you can catch when your element is dropped on one of the CellValuePresenter elements. In this event, you can use the event arguments to get the element that you hook the attached DragSource to, as well as the CellValuePresenter that you are dropping onto. The CellValuePresenter has a Value property that you can then set to the value that you have dragged.

    I have attached a sample project to demonstrate the above. I hope this helps you.

    Please let me know if you have any other questions or concerns on this matter.

    3288.XDGDragDropDemo.zip

    Sincerely,
    Andrew
    Associate Developer