I'm trying to accomplish something like this:
<DataTemplate.Triggers>
<EventTrigger RoutedEvent="{Binding MyEvent}">
<BeginStoryboard Storyboard="{StaticResource MyAnimation}" />
</EventTrigger>
</DataTemplate.Triggers>
MyEvent is event from my DataContext.
This does not work because RoutedEvent can't be Binding expression. Any idea how to accomplish this? In fact, I need some mix of EventTrigger and DataTrigger...
Solution with Blend SDK:
<Interactivity:Interaction.Triggers>
<Interactivity:EventTrigger SourceObject="{Binding}" EventName="MyEvent">
<ei:ControlStoryboardAction ControlStoryboardOption="Play">
<ei:ControlStoryboardAction.Storyboard>
<Storyboard>
....
</Storyboard>
</ei:ControlStoryboardAction.Storyboard>
</ei:ControlStoryboardAction>
</Interactivity:EventTrigger>
</Interactivity:Interaction.Triggers>
Using the EventTriggers from Interactivity
(Blend SDK) can trigger on any event on any object, the native ones only work for RoutedEvents
which you normally only have on controls.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With