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
810
Drag and Drop overview available?
posted

I'm just looking at adding drag and both directions between my tree and grid, have the simple sample and am wondering if there is a general drag and drop overview article to help me get started. I would especially like to know the following:

- how to display a drop allowed/not allowed and to prevent a drop if the wrong type of object.

- how to drag a row/node away so as to delete the object. And to confirm this is what is wanted.

- any other D+D best practices.

Thanks, Dave

Parents
No Data
Reply
  • 469350
    Suggested Answer
    Offline posted

    Hi Dave,

    Drag and drop are pretty much the same for every control. So I don't think there is any documentation on these topics specific to Infragistics. You might want to check out Microsoft's docs on the drag and drop events.

    codeslinger said:
    - how to display a drop allowed/not allowed and to prevent a drop if the wrong type of object.

    Basically, you handle this inside the drag events. There are properties on the event args that determine what types of drops are allowed.

    codeslinger said:
    - how to drag a row/node away so as to delete the object. And to confirm this is what is wanted.

    Not sure what you mean by "confirm this is what is wanted", but how you remove a node from the tree depends on how the tree gets it's data. If it's bound, then you would have to remove the item from the underlying data source. If it's not bound, you can simply remove the node using the Remove method. The grid is always bound, so you have to remove the item from the underlying data source.

    codeslinger said:
    - any other D+D best practices.

    Again, this is probably best explained in Microsoft's docs. I would start by looking up the various events like DragDrop and DragOver (or is it DragMove, I always mix them up) on MSDN.

    The only slightly tricky part of this in terms of the Infragistics controls is determining what's under the mouse at a particular point. You do this using UIElements. Here's a KB article that will point you in the right direction.

    HOWTO:UltraWinGrid Mouse Position and Row Identification

    Note that this article is using a point from the Mouse events and that Mouse events give you the coords in control coordinates. Drag events give you the coords in screen coordinates. So you have to call ScreenToClient before you pass them into the ElementFromPoint method.

Children