Drag and Drop on GridView Item

2 posts, 0 answers
  1. Frustrated Dev
    Frustrated Dev avatar
    35 posts
    Member since:
    Oct 2006

    Posted 29 Mar 2010 Link to this post


    I'm trying to drag and drop onto an item within a GridView. I know how to drag an element onto a GridView. However, I would like to know which item within the GridView I'm dropping an element onto. Is there a way to do this? If so, how?

    I tried setting the event handlers in my section that looks like this:
                                                <Style TargetType="gridview:GridViewRow">
                                                    <Setter Property="telerikDragDrop:RadDragAndDropManager.AllowDrag" Value="True" />
    but I did not have any luck.

    Thank you for your help!
  2. Tina Stancheva
    Tina Stancheva avatar
    3299 posts

    Posted 30 Mar 2010 Link to this post

    Hello Frustrated Dev,

    If you want to get the cell in which you are dropping the dragged item, it is best to set the AllowDrop on the GridViewCell like this:

    <telerikGrid:RadGridView x:Name="radGridView2"  >
                <Style TargetType="{x:Type telerikGridView:GridViewCell}">
                      <Setter Property="telerikDragDrop:RadDragAndDropManager.AllowDrop" Value="True" />

    This way in the e.Destination you'll see the GridCell you need.

    I prepared an example illustrating how you can drag and drop items from one grid to another.
    In the first grid (radGridView1) I set the AllowDrag and AllowDrop on the GridViewRows, while in the second one (radGridView2) I set the AllowDrop on the GridViewCell (as described above) and the AllowDrag on the GridViewRows.

    In the OnDropInfo() event handler when the drop has completed, I check whether the e.Options.Destination is a Telerik.Windows.Controls.GridView.GridViewCell and if it is, you can easily access the column header, for example.

    Please take a look at the example and let me know if it works for you or if you need more info.

    Tina Stancheva
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items.
Back to Top