Drag and Drop to a Specific Row in a RadGridView

2 posts, 0 answers
  1. Corey
    Corey avatar
    26 posts
    Member since:
    Nov 2012

    Posted 09 May 2013 Link to this post

    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.
  2. Corey
    Corey avatar
    26 posts
    Member since:
    Nov 2012

    Posted 09 May 2013 Link to this post

    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);
    }
  3. DevCraft banner
Back to Top