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

IsDropAllowed = false

5 Answers 192 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Karlheinz
Top achievements
Rank 1
Karlheinz asked on 23 Oct 2014, 04:25 PM
Hi, 
currently I have a little issue while the Drag&Drop actions. I use 2 GridViews, from one of them the user can drag elements an drop it on a separate control (not the second GridView). The problem is that the mouse over symbol indicates that the user can drop the item on the second grid, which he can't ... 

How can I disable the drop option and show the user he can't drop elements on the second grid? 

Thanks!

5 Answers, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 24 Oct 2014, 09:07 AM
Hi Karlheinz,

You can take two approaches here. The first is to set AllowDrop=False on the GridView that you don't want to be a drop target. This however will prevent all events apart from DragInitialize to not be fired. 

The other one, and probably the best one is to set the Effects to none in the DragOver event. 

Hope this helps. 

Regards,
Nik
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Karlheinz
Top achievements
Rank 1
answered on 27 Oct 2014, 10:55 AM
Thanks for the response!

replacing the Effects in the DragOver event doesn't have any impact: 
        private void RadGridView_DragOver(object sender, System.Windows.DragEventArgs e)
        {
            e.Effects = DragDropEffects.None;
        }

If I set AllowDrop="False" it works for the empty area in the Grid, but not for the Grid-Items. 
So if I drag over the items the, lets call it "Can-Drop", symbol reappears.
0
Nick
Telerik team
answered on 29 Oct 2014, 03:05 PM
Hi ,

This seems a bit strange. Have you checked if the event is fired when dragging over the rows? If not, you can use the 3rd parameter of the subscribe method - handledEventsToo = true when subscribing to the DragOver event.

If the event is still called it could be handled somewhere after your effects set. You can try setting e.Handled to true as well. 

Let me know how it goes. 

Regards,
Nik
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Karlheinz
Top achievements
Rank 1
answered on 30 Oct 2014, 02:03 PM
The solution is: 
        private void RadGridView_DragOver(object sender, System.Windows.DragEventArgs e)
        {
            e.Effects = DragDropEffects.None;
            e.Handled = true;
        }
Thanks
0
Karlheinz
Top achievements
Rank 1
answered on 30 Oct 2014, 02:04 PM
The solution is: 
        private void RadGridView_DragOver(object sender, System.Windows.DragEventArgs e)
        {
            e.Effects = DragDropEffects.None;
            e.Handled = true;
        }
Thanks
Tags
GridView
Asked by
Karlheinz
Top achievements
Rank 1
Answers by
Nick
Telerik team
Karlheinz
Top achievements
Rank 1
Share this question
or