How do I dynamically hide and unhide tabs in a TabControl ?

Platform: WPF| Category: TabControl

The TabItems have a Visibility property which can be set to Collapsed (no space will be reserved for this tab) or Hidden (not rendered, but space will be reserved for this tab).


[XAML]
 
        <TabControl x:Name='tabControl1'>
            <TabItem Header='Tab1'></TabItem>
            <TabItem Header='Tab2' Visibility='Hidden'></TabItem>
            <TabItem Header='Tab3' Visibility='Collapsed'></TabItem>
            <TabItem Header='Tab4'></TabItem>
        </TabControl>  

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.