I'm very new to WPF but I'm trying to mix the functionality of both a tab control and expanders.
I want to be able to press each tab item which has an expander in the header, that will expand the content below. Almost like a normal tab, except that I should now be able to press that tab/expander and the tab control should be able to expand/collapse, to only show the tab headers.
I can't get my head around to get the expand/collapse functionality to work, and the Tab control will always stay open like a normal one without expanders.
At the moment my XAML looks like this:
<TabControl>
<TabItem >
<TabItem.Header>
<Expander Header="One" IsHitTestVisible="False"
IsExpanded="{Binding IsSelected, RelativeSource={RelativeSource AncestorType={x:Type TabItem}}}" />
</TabItem.Header>
<TextBlock Background="Red"/>
</TabItem>
<TabItem>
<TabItem.Header>
<Expander Header="Two" IsHitTestVisible="False"
IsExpanded="{Binding IsSelected, RelativeSource={RelativeSource AncestorType={x:Type TabItem}}}" />
</TabItem.Header>
<TextBlock Background="Aqua" />
</TabItem>
</TabControl>
If I should go a completely another way to get the overall functionality, by all means, point me in that direction.
IsExpanded= false
am i right? – Avinash Reddy