Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
600
Change ActiveTab on DragOver
posted

Hi,

I've a TabControl with two Tabs. Now I want to drag something on one tab and if I drag over the TabHeader, the ActiveTab should change.

How can I find out, on which TabHeader I am ?

Thanks

Hansjörg Wintermantel

Parents
  • 37774
    posted

    Hansjörg,

    You would have to get the UIElement from the current mouse position and check to see if you can get a tab element, then mark it as selected if it is not already.  The following code should cover this:

    private void ultraTabControl1_DragOver(object sender, DragEventArgs e)
    {
        Point clientPt = this.ultraTabControl1.PointToClient(new Point(e.X, e.Y));
        TabItemUIElement tabItemElement = this.ultraTabControl1.UIElement.ElementFromPoint(clientPt) as TabItemUIElement;
        if (tabItemElement != null)
        {
            UltraTab tab = (UltraTab)tabItemElement.TabItem;
            if (!tab.Selected)
                tab.Selected = true;                   
        }
    }

    -Matt

Reply Children
No Data