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

Do more with drag drop

4 Answers 71 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 21 Jun 2012, 11:23 PM
Hi,

I've implemented the drag/drop functionality as explained in this link. It's working as described. However, I would like to extend the functionality so that at the end of a drop I can renumber a column in my bound ObservableCollection and possibly save the updated order to the database.

The first way I thought to do this was to create an event handler on drop in the radgridview xaml. However, if I break-point the newly created handler in code-behind, it never enters it. I assume this is because it is handled in the RowReorderBehavior class. I'd like to keep the classes I copied from the above link as-is, so that I can use them for other RadGridView's, but be able to implement the additional functionality.

How can I do this? I'm aware adding another event handler may not be the best way to go about it so I'm open to other ideas. 

4 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 22 Jun 2012, 10:53 AM
Hello,

 In order to subscribe for an event that has been already handled, I would suggest you to add the handler like so:

this.gridView.AddHandler(RadDragAndDropManager.DropQueryEvent, new EventHandler<DragDropQueryEventArgs>(gridView_OnDropQuery), true);

Then you could do your additional logic. Please try this and let me know how it works for you.

Greetings,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Peter
Top achievements
Rank 1
answered on 24 Jun 2012, 11:15 PM
Didie,

Thanks for your response, it does indeed raise the event specified so that's a step in the right direction. However the DropQuery event is raised as soon as I drag the row, and subsequently for every movement. I'd like an event that is raised when the item is dropped or ideally after the grid reshuffle. I noticed a DropInfo event in the RadDragAndDropManager as well, but it does the same as DropQuery. Can you help me further?
0
Accepted
Nick
Telerik team
answered on 25 Jun 2012, 05:44 AM
Hello Peter,

You can use the DropInfo event and check whether the Drop Status is DropComplete.

Hope this helps! 

All the best,
Nik
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Peter
Top achievements
Rank 1
answered on 25 Jun 2012, 07:14 AM
Yep that did it, thanks.
Tags
GridView
Asked by
Peter
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Peter
Top achievements
Rank 1
Nick
Telerik team
Share this question
or