Drag from one TileView to another

12 posts, 2 answers
  1. Jorn
    Jorn avatar
    222 posts
    Member since:
    Jun 2009

    Posted 09 Jun 2011 Link to this post

    Is this possible?
  2. Answer
    Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 09 Jun 2011 Link to this post

    Hi Jorn,
    Yes, you can do this with the RadDragAndDropManager -you can read about it here.
    I've attached a sample project which implements drag and drop between two RadTileViews so could you please examine it and if you have more questions feel free to ask.

    All the best,
    Zarko
    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. Jorn
    Jorn avatar
    222 posts
    Member since:
    Jun 2009

    Posted 10 Jun 2011 Link to this post

    Fantastic! Is there a way to leave the tile behind and only drag the textblock with the arrow?
    Edit: Nevermind - I've marked your reply as answered
  5. Jorn
    Jorn avatar
    222 posts
    Member since:
    Jun 2009

    Posted 15 Jun 2011 Link to this post

    I added this bit of code to show the dragcue only when the dragged item is above another tileview (since the tile itself is the dragcue before it leaves the container):

    If e.Options.Destination IsNot Nothing Then
        Dim dragCue As ContentControl = e.Options.DragCue
        If DirectCast(e.Options.Source, RadTileViewItem).ParentTileView.Name <> e.Options.Destination.Name Then
            dragCue.Visibility = Windows.Visibility.Visible
        Else
            dragCue.Visibility = Windows.Visibility.Collapsed
        End If
    End If
  6. Jorn
    Jorn avatar
    222 posts
    Member since:
    Jun 2009

    Posted 23 Jun 2011 Link to this post

    Is it possible to only allow the drag operation if the user drags the header element? (as it is now the drag operation is initiated anywhere in the tile)
  7. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 24 Jun 2011 Link to this post

    Hello Jorn,
    You can achieve with a little bit of code behind. You'll have to handle the MouseLeftButtonDown event and check if the user has clicked inside the GripBarElement (this is the area where the default drag and drop occurs) or somewhere else.
    Could you please examine the attached project and see if this is what you're looking for?

    All the best,
    Zarko
    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
  8. Jorn
    Jorn avatar
    222 posts
    Member since:
    Jun 2009

    Posted 10 Oct 2011 Link to this post

    Hello,

    In Q2 SP1 the first sample does not work anymore (I'm using the latest 1004 build).
    Execution mode is set to legacy.

    When IsItemDraggingEnabled = True (second listview) the the dragcue and arrowcue does not appear until you release the item; then they appear and they are stuck to the cursor until you left click again. Can you please look into this?
  9. Jorn
    Jorn avatar
    222 posts
    Member since:
    Jun 2009

    Posted 12 Oct 2011 Link to this post

    Bump!
  10. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 12 Oct 2011 Link to this post

    Hello Jorn,
    There are some changes to the DnDManager and that's why the old example doesn't work very well. To make it work again you have to remove 2 lines of code - in the OnDragQuery and the OnDropQuery methods you have to remove the e.Handled = true.
    I've attached the sample with those lines removed so could you please examine it and if you have more questions please feel free to ask.

    Kind regards,
    Zarko
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  11. Jorn
    Jorn avatar
    222 posts
    Member since:
    Jun 2009

    Posted 13 Oct 2011 Link to this post

    The DragCue is still not visible while you drag the tileview! The main difference (I actually didn't spot it before now) is that in Q2 the tileviewitem is visible when dragged outside it's parent tileview; prior to Q2 the tileviewitem disappeared at the border. I need the dragcue visible to tell my users where it's legal to drop the tileviewitem.
  12. Jorn
    Jorn avatar
    222 posts
    Member since:
    Jun 2009

    Posted 13 Oct 2011 Link to this post

    Update: the dragcue is only invisible if you drag the tileview by it's header. If you drag it in the middle the dragcue shows.
  13. Answer
    Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 14 Oct 2011 Link to this post

    Hi Jorn,
    If you want to see the DragCue when you start to drag by the header you'll have to cancel the default drag and drop in the RadTileView. You can do this by handling the PreviewTileDragStarted event like this:
    private void firstTileView_PreviewTileDragStarted(object sender, TileViewDragEventArgs e)
    {
        e.Handled = true;
    }
    Note that in this case you won't have the default TileView DnD.
    I've updated the attached project so you could examine it and if you have more questions please feel free to ask.

    All the best,
    Zarko
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top
DevCraft banner