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
180
Drag and Drop from xamDataGrid to another control
posted

I need to be able to drag from a xamDataGrid to another control (to keep it simple assume a regular label). Is there any sample code for this? I have been unable to find anything that looks like it is worth trying to implement (that is to say to implement the solution (and get it working!) would be less trouble than dumping all my xamDataGrids and using something else instead (aarrrgghhhhh!)).

I am getting the notion that Drag and Drop is not supported in the xamDataGrid which (polite cough)  shall we say is not exactly a good thing to discover. Surely this is core functionality for any type of GUI-based application?

Thanks

John French

  • 69686
    Suggested Answer
    posted

    Hello John,

    If order for a control to have built-in drag-drop functionality, it needs to "know" what should be dragged from it and where should be dropped (and if the Drop is available). This is pretty straightforward and is implemented, for example, with the ValueEditors, where it is intuitive that you will be dragging and dropping only text.

    For the XamDataGrid, which is the intuitive object to drag and where it is likely to be dropped? DataRecords, Cells, text from cells, other visual elements that are part of the XamDataGrid? If you are able to drag a Record, how would it be represented when dropped in a Label, TextBox or GridView for example? This is exactly why the WPF Framework gives you the full functionality to implement this logic by yourself.

    The XamDataGrid, as any other WPF control, support this and you are free to implement it by your requirements. You can see a sample Drag-Drop appication in this blog post.

    Hope this help.