This is a migrated thread and some comments may be shown as answers.

Touch Drag and Drop between Two Grid Views

1 Answer 110 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mansi A.
Top achievements
Rank 1
Mansi A. asked on 13 May 2015, 03:30 PM

Hello, 

 

    I have two Grid Views with drag and drop behavior. working perfect. 

     Gesture is enabled on both.

     However, When I try to use Touch (on Tablet)  to drag row from Grid1 to Grid2 is not working, What am I missing ? 

     

Thank You

Mansi Mansi 

 

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 18 May 2015, 12:16 PM
Hello Mansi,

Thank you for writing.

RadGridView drag and drop functionality should be handled differently when using gestures. You can override the RadGridView.OnPanGesture method and start the service when necessary. You can refer to our Extending RadGridView to Enable Row Drag and Drop Functionality blog post which is quite useful on this topic. As to the gestures support, you should start the RadDragDropService as follows:
public class DragAndDropRadGrid : RadGridView
{
protected override void OnPanGesture(PanGestureEventArgs args)
{
    base.OnPanGesture(args);
    GridCellElement cell = this.GridViewElement.ElementTree.GetElementAtPoint(args.Location) as GridCellElement;
    RadDragDropService dragDropService = this.GridViewElement.GetService<RadDragDropService>();
   
    if (args.IsBegin)
    {
        dragDropService.BeginDrag(this.ElementTree.Control.PointToScreen(args.Location),cell);
        
    }
 
    if (dragDropService.State == RadServiceState.Working)
    {
        dragDropService.DoMouseMove(this.ElementTree.Control.PointToScreen(args.Location));
    }
 
    if (args.IsEnd)
    {
        dragDropService.EndDrag();
    }
 
    args.Handled = true;
}
 //drag and drop implementation
}

It would necessary to modify the service events a little bit as the DragInstance is actually the cell, not the row element.

I hope this information helps. Should you have further questions, I would be glad to help.
 
Regards,
Dess
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
Mansi A.
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or