I have a DataTrigger
setup like so:
<UserControl.Resources>
<Style x:Key="resultTypeStyle">
<Style.Triggers>
<DataTrigger Binding="{Binding Result, Path=Result.Type}" Value="Confirmation">
<Setter Property="Control.Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</UserControl.Resources>
And two controls that use it:
<TextBlock Style="{StaticResource resultTypeStyle}" FontSize="14" Grid.Row="2">Condition</TextBlock>
<myns:ConditionBuilderView Style="{StaticResource resultTypeStyle}" DataContext="{Binding Condition}" Grid.Row="3"/>
The result type is changed by a combo box.
When the result type is Confirmation then the TextBox
disappears but the ConditionBuilderView
stays visible unless I remove the DataContext
attribute from it.
I need to set the DataContext
attribute so that the control gets the right data.
What does setting the data context do that means the visibility property no longer works?