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

Drag and Drop to a Specific Row in a RadGridView

1 Answer 102 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
Corey
Top achievements
Rank 2
Corey asked on 09 May 2013, 03:04 PM
I have two RadGridViews.  One displays a list of routes, and the other displays a list of stops on a route that updates itself when one clicks a route in the other grid.

I am trying to make it so that one can move any number of stops from the one grid and associate them with a different route in the other grid just by dragging and dropping the selected stops onto the desired route's specific row.

Example:

Grid 1                     Grid 2 (with Route 1 selected in Grid 1)
Route 1                   Route 1 Stop 1
Route 2                   Route 1 Stop 2

I would like to select "Route 1 Stop 1" and drag it over to "Route 2."  Upon release, "Route 1 Stop 1" would be associated with "Route 2" and not with "Route 1."  I believe I can manage this in the code behind.

So far I have successfully allowed drag and drop between the two grids and I can correctly determine which stops the user wishes to move to another route.  The problem I'm having is that I can't determine which route the user is trying to move the stops to.  My drop info handler only detects the e.Options.Destination as the entire Grid 1.  Is there any way to determine which specific row inside the radgrid that the user is hovering over during the drag and drop?  Even just finding the row's index would suffice.

Please help and, if possible, provide a reply using C# code.  I don't really use any XAML in my coding.

1 Answer, 1 is accepted

Sort by
0
Corey
Top achievements
Rank 2
answered on 09 May 2013, 05:15 PM
Never mind, I seem to have found my answer using e.GetElement.

void GridViewRowDropInfoHandler(object sender, DragDropEventArgs e)
{
          RadGridView order = e.Options.Destination as RadGridView;

          GridViewRow row = e.GetElement<GridViewRow>(e.Options.CurrentDragPoint);
}
Tags
DragAndDrop
Asked by
Corey
Top achievements
Rank 2
Answers by
Corey
Top achievements
Rank 2
Share this question
or