I have 2 tabs, when a button is clicked, tab2 is set to be collapsed. but the content of tab2 is still shown after the click.
Is a easier why to let the selected tab to be tab1 if tab2's visibility is set to collapsed.
Thanks,
Joan
yes. that works. but when I tired to use style to set this:
<Style x:Key="tab6to12Style" TargetType="igWindow:TabItemEx">
<Setter Property="Visibility">
<MultiBinding......>
..........
</Setter>
</Style>
I have to apply that style to tab 6 to tab 12. then tab 6 to 12 lost the style that tab1 to 5 have. the tab header color and clickedon-change color is lost.
<igWindows:TabItemEx Header="Tab 9" Style="{StaticResource tab6to12Style}">
should I add BasedOn in the style definition? but what is the default style name for all?
Hi Joan,
The area where the content is displayed is treated differently than where the tab headers are. This means that setting the visibility of the tab item is only going to effect the tab header, not the content area. You have three options that I'm aware of that will hide the content area as well.
1.) The first option is to use what you suggested and switch the selected tab to tab1 when tab2 is collapsed.
2.) Option two is to bind tab2's content to tab2's visibility so when the tab is collapsed, the content will collapse as well.
<igWindows:TabItemEx Header="Tab 2" x:Name="tab2"> <Grid Visibility="{Binding ElementName=tab2, Path=Visibility}"> <!-- Tab 2 content goes in here. --> </Grid> </igWindows:TabItemEx>
3.) Remove tab2 from the tab control when you want to "collapse" it. Place it back in the tab control when you want it visible.
I personally think option two is easiest as it can all be done in XAML without adding anything extra in code-behind.
Let me know if you have any questions on this.