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

DragAndDrop RadGridView, Drag into Grid whitespace

2 Answers 64 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 09 Apr 2015, 04:56 PM

When using the Telerik example from http://docs.telerik.com/devtools/wpf/controls/dragdropmanager/how-to/howto-draganddrop-within-radgridview.html dragging an item to the empty space in the RadGridView causes the row to go to the top of the list. Is this the desired behavior? Is there a way to disable it?

 I have attached a picture of dragging to the whitespace. The "spike" row is the last row. If I drag the "spike" row to the bottom whitespace, the "spike" row will become the top row in the list.

2 Answers, 1 is accepted

Sort by
0
Chris
Top achievements
Rank 1
answered on 09 Apr 2015, 08:55 PM

If I add the following to OnDrop in RowReorderBehaviour.cs it solves the issue.

 

// this occurs when you drag an item over itself
if (details.CurrentDraggedItem == details.CurrentDraggedOverItem)
{
  return;
}
 
// this occurrs when you drag an item without ever dragging over another item
if (details.CurrentDraggedOverItem == null)
{
  return;
}

 

0
Dimitrina
Telerik team
answered on 10 Apr 2015, 07:05 AM
Hello Chris,

Thank you for sharing the solution you found with the community. You can also check the most recent "Reorder Rows" example available with WPF Demos on how to perform row reordering. 

Regards,
Dimitrina
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
DragAndDrop
Asked by
Chris
Top achievements
Rank 1
Answers by
Chris
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or