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

DragStatus always DragImpossible on RadGridView Header Cell

4 Answers 102 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
Dave Baumann
Top achievements
Rank 1
Dave Baumann asked on 09 Feb 2012, 05:58 PM
After updating the Telerik RadControls for Silverlight to version 2011.3.1116.1040 we have found a problem with using the RadDragAndDropManager with the RadGridView. We have a scenario where we drag and drop items between two RadGridViews.  We are no longer able to drop items onto the Header Row of the RadGridView. The e.Options.Status in the OnDropInfo handler always returns DragStatus.DropImpossible. It looks like the source RadGridView is the only element firing the Drop Event and the target RadGridView is not firing the drop event at all.

This worked prior to updating the controls to the version noted above.

In our target OnDropQuery and OnDropInfo hanlders we added to following lines of code to allow the user to drop an item onto the header row of the RadGridView. It is now never being called.

    if (target is Telerik.Windows.Controls.GridView.GridViewHeaderCell)
            {
                gridview = ((GridViewHeaderCell)target).ParentRow.GridViewDataControl as RadGridView;
            }

The challenge is that when we have an empty RadGridView, we have no target to drop to.

4 Answers, 1 is accepted

Sort by
0
Accepted
Nick
Telerik team
answered on 10 Feb 2012, 01:58 PM
Hello Dave,

How exactly have you realized the DragAndDrop scenario? Mind that the Header Row cells handle the drag and drop events, so you will have to add the handlers with handledEventsToo set to true.

this.GridView.AddHandler(RadDragAndDropManager.DragQueryEvent, new EventHandler<DragDropQueryEventArgs>(OnDragQuery), true);
            this.GridView.AddHandler(RadDragAndDropManager.DragInfoEvent, new EventHandler<DragDropEventArgs>(OnDragInfo), true);
            this.GridView.AddHandler(RadDragAndDropManager.DropQueryEvent, new EventHandler<DragDropQueryEventArgs>(OnDropQuery), true);
            this.GridView.AddHandler(RadDragAndDropManager.DropInfoEvent, new EventHandler<DragDropEventArgs>(OnDropInfo), true);

I am attaching a small project demonstrating how you can achieve the desired functionality.

Hope this helps!

All the best,
Nik
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Dave Baumann
Top achievements
Rank 1
answered on 10 Feb 2012, 06:12 PM
Thanks for the reply Nik.

Unfortunately my target RadGridViews are contained in a ListBox. On the left hand side I have a RadGridView of Unassigned work items, the Unassigned Queue. On the right-hand side I have a ListBox of Queues for users. The DataTemplate for those Queues is a RadGridView. Because the target RadGridViews are contained in a DataTemplate I cannot reference those RadGridViews by name in the code behind.

Here is how I am registering the DropHandlers at the page level in the code behind.

     RadDragAndDropManager.AddDragQueryHandler(this, OnDragQuery);
            RadDragAndDropManager.AddDragInfoHandler(this, OnDragInfo);
            RadDragAndDropManager.AddDropQueryHandler(this, OnDropQuery);
            RadDragAndDropManager.AddDropInfoHandler(this, OnDropInfo);

The code that checks the GridViewHeaderRow in the original post works with the .dlls you reference in your project.

However, I changed the event bindings wiring them up to the standalone GridView and also to the parent ListBox containing the DataTemplate GridViews as in your example and the event handlers now work again as expected.

Thanks,

Dave
0
Brandon
Top achievements
Rank 1
answered on 23 May 2012, 10:46 PM
I am trying to implement something similar.  I have child grids that I want to drop on as well - and the header cells (of the parent and child grids) always have DragStatus.DropImpossible - even after I set all of the AllowDrop properties on the header cells and header row to true.  Any ideas?

Thanks!
0
Sravanthi
Top achievements
Rank 1
answered on 20 Nov 2013, 09:37 AM

Hello Dave,

I have two Telerik RadGridViews. When the first RadGridView is empty I am unable to drag Items from second Grid.


Thanks,
Sravanthi
Tags
DragAndDrop
Asked by
Dave Baumann
Top achievements
Rank 1
Answers by
Nick
Telerik team
Dave Baumann
Top achievements
Rank 1
Brandon
Top achievements
Rank 1
Sravanthi
Top achievements
Rank 1
Share this question
or