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

Disable drop based on source grid

3 Answers 104 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 31 Jul 2012, 05:13 AM
Hi,

I've been using the RowReordering tutorials to implement my drag & drop functionality and I'm trying to prevent certain grids from dropping their draggedItems into a grid. I'm thinking all I need is the target and source grid references, performing a simple comparison or test and show the "disabled" drag effect. I can get the target grid object but not the source grid object from inside the OnDragOver or OnDrop event handlers.

How can I do this? 

Thanks

3 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 31 Jul 2012, 01:56 PM
Hi,

Indeed, the source GridView is not available in the drop arguments. What I can suggest to you is one of those approaches:
1. Get the source GridView when the OnDragInitialize event is raised.
    Save it.
    Use the saved instance when the OnDrop event is raised.

2. Pass the source GridView through the "DropDetails" of the IDragPayload:

IDragPayload dragPayload = DragDropPayloadManager.GeneratePayload(null);
dragPayload.SetData("DropDetails", sourceGridView);
I hope this helps.

Kind regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Peter
Top achievements
Rank 1
answered on 01 Aug 2012, 12:27 AM
Hi,
Thank you, How would you do this with grids on different UI(separate window). From the solution you gave how can I get the "DropDetails" from target Grid. I am using http://demos.telerik.com/silverlight/#TreeListView/TreeListViewDragAndDrop from one window and http://www.telerik.com/help/wpf/raddraganddrop-within-radgridview.html from another window.

Thank you
0
Dimitrina
Telerik team
answered on 03 Aug 2012, 06:54 AM
Hi,

The article that you have pointed to is related to RadDragAndDropManager. As it will not be supported any more, I would suggest you to check our online documentation on DragDropManager and use it instead.

An example on how to dragdrop within GridView and how to set the "DropDetails" please check the source code for the "Reorder Rows" WPF Demo

Kind regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Peter
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Peter
Top achievements
Rank 1
Share this question
or