What's wrong with default WPF TabControl?

Well, nothing is wrong with it except that in some use cases it becomes ugly and unusable. If there are too many tabs, you'll get something like this:
It looks and feels like a waste of precious screen space, which is bad. In real life, I haven't seen any users who liked such behaviour. If only we could make it better...

So, what are our options? If a better TabControl uses only one line to display all items, how could we resolve the situation when there is just not enough space to show everything?
  1. Scaling/Truncating. It is a viable idea which many other developers have adopted. But what could happen is that every tab item might become too small to remain usable.
  1. Scrolling. Instead of making every individual tab item smaller, we can add support for scrolling tab items. And that's exactly what I did.

Better WPF TabControl features

  • Scrolling
Better TabControl shows what it can, and hides everything else - it's that simple. In order to reach hidden content, there are two buttons which scroll items to the left or to the right:
You can replace buttons with your own content if you like. In order to do this, override BetterTabControl.ScrollToLeftContent or BetterTabControl.ScrollToRightContent properties respectively.
  • Quick links to all tabs
If you don't want to scroll, you can use quick links pane. In order to show it, set BetterTabControl.ShowQuickLinksButton property to True (it is set to True by default). As a result new button will be shown at the top right corner of the tab control. When you click on it, you'll see the list of all tab items you have:
If you click on a item, a corresponding tab will be selected in the tab control.
  • Fixed tab items
You can "lock" some of the tab items. It might be usefull when you have tabs which should be always visible, no matter how many tabs users have opened.
As you see, tab "Summary" is locked and does not particiate in scrolling.

Last edited Jan 9, 2012 at 3:38 AM by neutrino42, version 3


No comments yet.