Reputation: 371
Is there any good solution to this problem.
I have set the
tabitem.visibility=hidden
but the contents in this tabitem is still visible. I want to hide all the contents of tabitems.
I did search for a resolution but no luck. In 2009 someone raised this issue but still NOW there is no result on how to achieve this. URL: http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/e4d23ace-0eb5-45a9-86f5-43c6351cb0ed/
Thanks
Upvotes: 7
Views: 9615
Reputation: 3435
To fix your problem use Visibility.Collapsed. Visibility.Hidden won't change the layout and so you would always have that empty space in the tab header. Be sure to change the selected tab as well when that happens.
I wouldn't recommend hiding tab items like that though. Conceptually they are either open or closed.
Upvotes: 8
Reputation: 4454
Try to hide the TabControl by setting it's visibility to Visibility.Hidden or switch to another tab (maybe an empty one?). You didn't give much reason why you do it, but if you really want to hide all controls in the tabcontrol, you can also iterate through tabItem.Children and set their Visibility to Visibility.Hidden.
Upvotes: 0