Drop Highlight

4 posts, 0 answers
  1. Kim
    Kim avatar
    27 posts
    Member since:
    Sep 2010

    Posted 15 Sep 2010 Link to this post


    Hi, I am trying to get the RadDragDrop manager working as i need and I am getting close.

    However, I have a grid that contains a usercontrol in each cell (similar to a calender). When the mouse moves over a cell i change the backcolor of the cell (mouse enter/leave events). When i drag something over the cell, the mouse enter/leave events no longer fires. Is this a bug or by design?

    I have the DropQueryEvent wired to each user control in the cells and when i drag onto the cell the DropQueryEvent fires for the user control the drag enters. I can determine this way when a drag enters the cell  the usercontrol in the cell changes its own back color, however, i can't tell when the drag leaves the cell so i can change it back.

    Basically i am trying to implement a DropHighlight and i've hit a wall. Maybe i'm missing something obvious.

    Please help!

    Thanks.






  2. Yavor Georgiev
    Admin
    Yavor Georgiev avatar
    982 posts

    Posted 16 Sep 2010 Link to this post

    Hi Kim,

     You would need to keep an instance of the previously highlit UserControl in a field, so that when DropQuery fires for a new UserControl, you restore the Background of the previous UserControl.

    Sincerely yours,
    Yavor Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Kim
    Kim avatar
    27 posts
    Member since:
    Sep 2010

    Posted 16 Sep 2010 Link to this post

    Thanks for you reply.

    I found a better way.

    If I add event handlers to the usercontol itself, the dragdrop manager will actually fire a "Dropimpossible" status when the drag leaves the usercontrol. So now I have basically created a DragEnter and DragLeave event for each user control. Works very slick!

    The usercontrol now has its own drop functionality and I can handle the event by setting e.Handled = true to prevent it from propagating.

    When a dragged item enters a usercontrol, the usercontrol I can check to see if the item being dragged is approporiate for itself and behave accordingly.

    if you want to see a sample of it working  http://www.dobranski.ca

    Thanks.

  5. Justin
    Justin avatar
    2 posts
    Member since:
    Apr 2008

    Posted 18 Nov 2010 Link to this post

    Kim-

    Thank you so much for sharing.
    Your suggestion work perfectly.
    // OnDropInfo event handler
    private void OnDropInfo(object sender, DragDropEventArgs e)
    {
        if (e.Options.Status == DragStatus.DropImpossible)
        {
            removeHighlight(); //... my code to remove highlight
        }
      
        // Drop has completed successfully
        if (e.Options.Status != DragStatus.DropComplete) return;
      
        //... my code here to handle the drop
      
        e.Handled = true;
    }

    removeSwimlaneHighlight();
    }
    if (e.Options.Status == DragStatus.DropImpossible)
    {
    removeSwimlaneHighlight();
    }
    if (e.Options.Status == DragStatus.DropImpossible)
    {
    removeSwimlaneHighlight();
Back to Top