Click here to Skip to main content
15,072,776 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All ,

I have a list of objects (Say 'Foo' objects) which is set as the ItemsSource of a TabControl. What I need to do is to hide the header of the first tab inside this tab control.
What's the best way to accomplish this?

This can perhaps be achieved by setting a style for a TabItem but how do I specify that only the first Tab's header is to be collapsed whereas the remaining Tabs header should be left as is.

Thanks for any help

1 solution

Hello Hellraiser123

You can select the first TabItem of the TabControl and set it's visibility to "collapsed".
The result of this would be that the TabControl just ignores the first TabItem while it displays the others.

The code looks like the following:
((TabItem)tabCtrl.Items[0]).Visibility = System.Windows.Visibility.Collapsed; 

Where tabCtrl is the name of your TabControl.
aihua1 25-Oct-16 6:31am
Cann't convert string to TabItem!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900