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
120
Finding UltraGridRow, when dragging an Item from UltraExplorerBar and dropping on UltraGrid
posted

I am having the functionality of Drag and Drop.

Dragging an Item from UltraExplorerBar and dropping on to a UltraGrid. I am able to achieve this functionality by implementing DragDropManager.IDragSource, DragDropManager.IDropTarget interfaces for Drag and drop respectively. I am also using DragDropManager class from Infragistics Samples.

 

But I am not able to achieve the following functionality –

  • On drag of an item from UltraExplorerBar and dropping on UltraGrid, I want to know the Row on which the user drops the item.

Thanks,

Madhav

Parents
No Data
Reply
  • 69832
    Suggested Answer
    Offline posted

    Assuming you have implemented the IDropTarget interface for the UltraGrid, in the OnDropTargetNotify method implementation for the DragOver case, add the following code:

                UltraGrid grid = sender as UltraGrid;
                Point point = grid.PointToClient(Control.MousePosition);
                UIElement controlElement = grid.DisplayLayout.UIElement;
                UIElement elementAtPoint = controlElement != null ? controlElement.ElementFromPoint( point ) : null;
                UltraGridRow rowAtPoint = elementAtPoint != null ? elementAtPoint.GetContext( typeof(UltraGridRow) ) as UltraGridRow;
                if ( rowAtPoint != null )
                {
                }

    This will give you a reference to the row at the current cursor position, if there is one.

Children