4

I have a TabControl object with some TabItem objects inside. Now the sum of width of TabItem is not long enough to fill the space on right:

Now I wish to have one of following design:

alt text http://img111.imageshack.us/img111/4158/67279984.png

What properties should I set to archieve one of the design above? For the second design, I tried to adjust HorizontalAlignment property (to "center") in TabItem objects and HorizontalContentAglinment property (to "center") in TabControl object, but neither works.

Could someone point out what should I do to implement the design? I prefer the first design, but if it is impossible or very difficult, the second one would be nice too.

Thanks.

Kent Boogaart
  • 175,602
  • 35
  • 392
  • 393

2 Answers2

2

The tabs are arranged by the TabControl's HeaderPanel. You need to replace the HeaderPanel to change the layout. It seems like the only way to do this is with a ControlTemplate. Here is an article that will show you how to do that: http://www.codeproject.com/KB/WPF/WpfSqueezeTabPanel.aspx.

hwiechers
  • 14,583
  • 8
  • 53
  • 62
  • Close, but I wouldn't use that squeeze panel. Just re-template and use some simpler primitive panel, for example, UniformGrid with Rows set to 1. UniformGrid is intelligent enough to spread out N items equally across the width. – Charlie Mar 26 '14 at 00:05
0

Please see my answer on this similar question(If I understood correctly): How to Stretch WPF Tab Item Headers to Parent Control Width

Community
  • 1
  • 1
XMight
  • 1,991
  • 2
  • 20
  • 36