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

Drag Tab Item to RadPanel

1 Answer 81 Views
Tabstrip (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tony
Top achievements
Rank 1
Tony asked on 06 Feb 2009, 04:27 PM
I need to drag a tab item to a RadPanel.  On the drop, I want to take the Tag Object from the tab item and implement a process using the information therein.  I don't need the tab item itself, just the 'look and feel' of a drag for the user.  I know I can move the tabs around in the strip itself and, for that matter, the drag display also is visible over my Radpanel.  I just need to generate an event to grab the tab item object.  The TabDragEnded event only fires when it is dropped within the strip container.

Thanks

1 Answer, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 09 Feb 2009, 05:24 PM
Hello Tony,

Thank you for writing.

I have attached sample application to demonstrate how to do the Drag & Drop. Basically you have to subscribe to three events:

First you subscribe to RadTabStrip's TabDragStarted event. Here you call RadTabStrip's DoDragDrop() method passing it TabDragEventArgs' DraggedItem property.
 
private void radTabStrip1_TabDragStarted(object sender, TabDragEventArgs args)  
{  
    args.DraggedItem.Tag = "Tag of " + args.DraggedItem.Text;  
    radTabStrip1.DoDragDrop(args.DraggedItem, DragDropEffects.Copy);  
}  
 

Second you subscribe to RadPanel's DragEnter event and check if the incoming data is a TabItem. If it is
you assign the DragEventArgs Effect property some value. Like this
 
if(e.Data.GetDataPresent(typeof(TabItem)))  
{  
    e.Effect = DragDropEffects.Copy;  

And finally you handle RadPanel's DragDrop event.
 
private void radPanel1_DragDrop(object sender, DragEventArgs e)  
{  
    if (e.Data.GetDataPresent(typeof(TabItem)))  
    {  
        TabItem item = e.Data.GetData(typeof(TabItem)) as TabItem;  
        // Do something item.Tag  
    }  
}  
 
 
I hope this is what you are looking for. Please write back if you need further assistance.

Regards,
Victor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Tabstrip (obsolete as of Q2 2010)
Asked by
Tony
Top achievements
Rank 1
Answers by
Victor
Telerik team
Share this question
or