Drag Tab Item to RadPanel

2 posts, 0 answers
  1. Tony
    Tony avatar
    14 posts
    Member since:
    Jul 2008

    Posted 06 Feb 2009 Link to this post

    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
  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 09 Feb 2009 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top