How do I define a DataTrigger for a StackPanel? It does have a Trigger property, but defining a trigger here gives the following error on Initialize when starting the application:
Failed object initialization (ISupportInitialize.EndInit). Triggers collection members must be of type EventTrigger. ....
This is given from the following simple DataTrigger:
<StackPanel x:Name="PersonPanel" DataContext="{Binding CurrentPerson}">
<TextBlock Text="{Binding Id}" />
<TextBlock Text="{Binding Name}" />
<StackPanel.Triggers>
<DataTrigger Binding="{Binding Id}" Value="1">
<Setter TargetName="PersonPanel" Property="StackPanel.Background" Value="Green" />
</DataTrigger>
</StackPanel.Triggers>
</StackPanel>
This is my first Trigger ever, so what do I do wrong? Should I define the trigger elsewhere?