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

Drag from ListView to Panorama

3 Answers 47 Views
ListView
This is a migrated thread and some comments may be shown as answers.
jesse
Top achievements
Rank 1
jesse asked on 25 Jul 2015, 02:07 PM
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?

3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 27 Jul 2015, 07:41 AM
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
0
jesse
Top achievements
Rank 1
answered on 27 Jul 2015, 05:28 PM
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?
0
Stefan
Telerik team
answered on 28 Jul 2015, 05:53 AM
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
Tags
ListView
Asked by
jesse
Top achievements
Rank 1
Answers by
Stefan
Telerik team
jesse
Top achievements
Rank 1
Share this question
or