Drag from ListView to Panorama

4 posts, 0 answers
  1. jesse
    jesse avatar
    6 posts
    Member since:
    Jul 2014

    Posted 25 Jul 2015 Link to this post

    I would like to Drag an item from a RadListView into a Panorama, which in turn would create a new tile based on some data from the dragged Item, can someone point me to documentation or code that does something like this?
  2. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 27 Jul 2015 Link to this post

    Hi Jessie,

    Thank you for writing.

    For the purpose, you should use the DragDropService of RadListView. Here is a small example to get you started:
    private void DragDropService_PreviewDragDrop2(object sender, RadDropEventArgs e)
    {
        if (radPanorama1.ShowGroups)
        {
            TileGroupElement hoveredGroup = radPanorama1.ElementTree.GetElementAtPoint(e.DropLocation) as TileGroupElement;
            if (hoveredGroup != null)
            {
                RadTileElement newTile = new RadTileElement();
                newTile.Text = ((SimpleListViewVisualItem)e.DragInstance).Data.Text;
                hoveredGroup.Items.Add(newTile);
                //newTile.row
                //newTile.Column
                //newTile.RowSpan
                //newTile.ColSpan
            }
     
            RadTileElement hoveredTile = radPanorama1.ElementTree.GetElementAtPoint(radPanorama1.PointToScreen(e.DropLocation)) as RadTileElement;
            if (hoveredTile != null)
            {
                TileGroupElement tileGroup = hoveredTile.FindAncestor<TileGroupElement>();
                if (tileGroup != null)
                {
                    RadTileElement newTile = new RadTileElement();
                    newTile.Text = ((SimpleListViewVisualItem)e.DragInstance).Data.Text;
                    tileGroup.Items.Add(newTile);
                }
            }
     
            RadPanoramaElement hoveredControl = radPanorama1.ElementTree.GetElementAtPoint(radPanorama1.PointToScreen(e.DropLocation)) as RadPanoramaElement;
            if (hoveredControl != null)
            {
                RadTileElement newTile = new RadTileElement();
                newTile.Text = ((SimpleListViewVisualItem)e.DragInstance).Data.Text;
                hoveredControl.Items.Add(newTile);
            }
        }
        else
        {
            RadTileElement newTile = new RadTileElement();
            newTile.Text = ((SimpleListViewVisualItem)e.DragInstance).Data.Text;
            radPanorama1.Items.Add(newTile);
        }
    }

    I hope that you find this information useful. Should you have any other questions, do not hesitate to contact us.

    Regards,
    Stefan
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
  4. jesse
    jesse avatar
    6 posts
    Member since:
    Jul 2014

    Posted 27 Jul 2015 in reply to Stefan Link to this post

    Thank you, this was most helpful.  The only issue i have now is that when there are several tiles in a group, moving them is *very* slow.  Is there a way to improve that by maybe turning off the animation?
  5. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 28 Jul 2015 Link to this post

    Hello Jesse,

    I am unable to replicate slow down with the tiles in the panorama. Attached you can find the project I've tested with. Can you have a look at it and let me know if I am missing something?

    I am looking forward to your reply.

    Regards,
    Stefan
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
Back to Top