IsDropAllowed = false

6 posts, 0 answers
  1. Karlheinz
    Karlheinz avatar
    4 posts
    Member since:
    Aug 2012

    Posted 23 Oct 2014 Link to this post

    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!
  2. Nick
    Admin
    Nick avatar
    593 posts

    Posted 24 Oct 2014 Link to this post

    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.

     
  3. Karlheinz
    Karlheinz avatar
    4 posts
    Member since:
    Aug 2012

    Posted 27 Oct 2014 in reply to Nick Link to this post

    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.
  4. Nick
    Admin
    Nick avatar
    593 posts

    Posted 29 Oct 2014 Link to this post

    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.

     
  5. Karlheinz
    Karlheinz avatar
    4 posts
    Member since:
    Aug 2012

    Posted 30 Oct 2014 in reply to Nick Link to this post

    The solution is: 
            private void RadGridView_DragOver(object sender, System.Windows.DragEventArgs e)
            {
                e.Effects = DragDropEffects.None;
                e.Handled = true;
            }
    Thanks
  6. Karlheinz
    Karlheinz avatar
    4 posts
    Member since:
    Aug 2012

    Posted 30 Oct 2014 in reply to Nick Link to this post

    The solution is: 
            private void RadGridView_DragOver(object sender, System.Windows.DragEventArgs e)
            {
                e.Effects = DragDropEffects.None;
                e.Handled = true;
            }
    Thanks
Back to Top