Hello,
I have a ItemsControl in my XAML code. When some trigger occur i want to collapse the full itemsControl, so all the elements.
<ItemsControl Name="VideoViewControl" ItemsSource="{Binding Videos}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel ItemHeight="120" ItemWidth="160" Name="wrapPanel1"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<views:VideoInMenuView />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
The trigger:
<DataTrigger Value="videos" Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}, AncestorLevel=1}, Path=DataContext.VideosEnable}">
<Setter Property="ScrollViewer.Visibility" Value="Visible" TargetName="test1" />
<Setter Property="ScrollViewer.Visibility" Value="Collapsed" TargetName="test2" />
<Setter Property="WrapPanel.Visibility" Value="Collapsed" TargetName="wrapPanel1" />
</DataTrigger>
When I add the last setter the program crashes. Without this last setter it works fine but no visibility change....
What is wrong with this code? What is the write method to collapse all the elements of a ItemsControl with a trigger?