user191720
user191720

Reputation:

Adjusting TabItem width automatically to fill spaces?

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.

Upvotes: 4

Views: 11506

Answers (2)

XMight
XMight

Reputation: 2121

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

Upvotes: 0

hwiechers
hwiechers

Reputation: 14995

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.

Upvotes: 2

Related Questions