What I want to do is have the tabitem content only visible when the TabItem IsSelected and Expander IsExpanded
The problem I have right now is:
- if the Expander IsHitTestVisible="False" then the TabItem IsSelected but the Expander does not Expand (/Collapse)
- if the Expander IsHitTestVisible="True" then the TabItem Is NOT
Selected but the Expander does Expand (/Collapse)
What I need the the behavior of both IsHitTestVisible="False" and IsHitTestVisible="True". How can I achieve that behavior?
I know there is not real content in the Expander
I just want the value of IsExpanded to use in the Converter (and for the arrow to go up and down)
What I want is for the Expander to pass the click on to the TabItem
<TabItem x:Name="tabitem3">
<TabItem.Header>
<Expander Header="Three" x:Name="tabexp3"/>
</TabItem.Header>
<TextBlock Text="Content Three TabItem" Background="Honeydew" >
<TextBlock.Visibility>
<MultiBinding Converter="{StaticResource bvc2}" Mode="OneWay">
<Binding ElementName="tabexp3" Path="IsExpanded"/>
<Binding ElementName="tabitem3" Path="IsSelected" />
</MultiBinding>
</TextBlock.Visibility>
</TextBlock>
</TabItem
public class VisabilityConverterTwoBool : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
//if (values == null) return Visibility.Visible;
//if (values.Length != 2) return Visibility.Visible;
if (values.Length != 2) return Visibility.Collapsed;
if (values[0] as bool? == null || values[1] as bool? == null)
{
Debug.WriteLine(values[0].ToString());
Debug.WriteLine(values[1].ToString());
return Visibility.Collapsed;
}
//if (values.Length != 2 && values[0] as bool? == null || values[1] as bool? == null) return Visibility.Visible;
try
{
Debug.WriteLine(((bool)values[0]).ToString() + " " + ((bool)values[1]).ToString());
if ((bool)values[0] && (bool)values[1]) return Visibility.Visible;
else return Visibility.Collapsed;
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message, "VisabilityConverterTwoBool");
Debug.WriteLine(values[0].ToString());
Debug.WriteLine(values[1].ToString());
}
return Visibility.Visible;
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
{
return null;
}
}