Tabs Studio Blog (organizing Visual Studio document tabs)

August 22, 2009

Internal tab order

Filed under: Uncategorized — Tags: — Sergey Vlasov @ 8:43 am

Tab order in Tabs.TabPanel and Tabs.TabList can be different. By default a new tab is added to the end of both TabPanel and TabList. After that tabs can be reordered in TabPanel, manually using drag’n'drop or automatically using Sorter like add-in. Order in TabList remains constant. If it is important to handle tabs the way a user sees it then process them in TabPanel order.

To find TabItem in TabPanel having TabsStudioExt.Tab just use the Tab.TabItem property. To find TabsStudioExt.Tab having TabItem in TabPanel use function like this:

private TabsStudioExt.Tab FindTabByItem(System.Windows.Controls.TabItem tabItem, TabsStudioExt.Tabs tabs)
{
    foreach(TabsStudioExt.Tab tab in tabs.TabList)
    {
        if (tab.TabItem == tabItem)
            return tab;
    }
    return null;
}

You can sort TabList according to TabPanel ordering and then work with TabList collection having sure tab order is in the way a user sees it:

tabList.Sort(
    delegate(TabsStudioExt.Tab lhs, TabsStudioExt.Tab rhs)
    {
        return tabs.TabPanel.Children.IndexOf(lhs.TabItem).CompareTo(
                    tabs.TabPanel.Children.IndexOf(rhs.TabItem));
    });

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

Please log in to WordPress.com to post a comment to your blog.

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Theme: Shocking Blue Green. Blog at WordPress.com.