Adjusting TabItem width automatically to fill spaces?

10,873

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.

Share:
10,873
Admin
Author by

Admin

Updated on June 27, 2022

Comments

  • Admin
    Admin almost 2 years

    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.