Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Tabstrip (obsolete as of Q2 2010) > radTabStrip DragDrop

Answered radTabStrip DragDrop

Feed from this thread
  • Marc avatar

    Posted on Jan 9, 2009 (permalink)

    I am trying to implment the ability for another control to drag and drop onto tabs in a radTabStrip.  I have been able to implment most of it, but am having difficulty determining which tab the user dropped on. 

    I would have thought I could put the following code in the DragDrop event of the TabStrip, but the GetItemByPoint always returns nothing, even when tabs were dropped on.

    Dim tab As Telerik.WinControls.UI.TabItem  
     
    tab = radTabStrip.TabStripElement.GetItemByPoint(New Point(e.X, e.Y))  
     
    If tab IsNot Nothing Then  
        MsgBox(tab.Name)  
    End If  
     

    Any help would be appreciated.

    I am using VB.NET in VS2008

    Thank you -- controls are still fantastic

    Reply

  • Answer Victor Victor admin's avatar

    Posted on Jan 9, 2009 (permalink)

    Hi Marc,

    Thanks for writing.
    You can get a reference to the tab you are dropping on by iterating over the Items collection of the RadTabStrip and checking if its Bounds property contains the point that you clicked on. A somewhat subtle detail is that you have to convert the Bounds rectangle to screen coordinates since e.X and e.Y are in screen coordinates.
    Here is the code:
    Private Sub RadTabStrip1_DragDrop(ByVal sender As System.ObjectByVal e As System.Windows.Forms.DragEventArgs) Handles RadTabStrip1.DragDrop  
            Dim i As Integer 
            Dim p As Point  
            p.X = e.X  
            p.Y = e.Y  
            For i = 0 To RadTabStrip1.Items.Count - 1  
                If RadTabStrip1.Items(i).RectangleToScreen(RadTabStrip1.Items(i).Bounds).Contains(p) Then 
                    MessageBox.Show("Found tab item! This is " + RadTabStrip1.Items(i).Text)  
                    RadTabStrip1.Items(i).Text = e.Data.GetData(GetType(String)).ToString()  
                    RadTabStrip1.Items(i).ForeColor = Color.Red  
                End If 
            Next 
        End Sub 
    Please do write again if you have more questions.

    All the best,
    Victor
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.

    Reply

  • Marc avatar

    Posted on Jan 9, 2009 (permalink)

    Yep, that did it!

       

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Tabstrip (obsolete as of Q2 2010) > radTabStrip DragDrop
Related resources for "radTabStrip DragDrop"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]