Page 1 of 1

How to start a Storyboard from a DataEventTrigger?

Posted: 08 Jul 2022, 12:49
by asusralis
I want to start a storyboard when an event from a viewmodel is invoked. What is the best way of doing this?

Re: How to start a Storyboard from a DataEventTrigger?

Posted: 11 Jul 2022, 17:01
by sfernandez
Hi, you have to use the ControlStoryboardAction to begin the storyboard:
<Grid
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
   xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
   xmlns:noesis="clr-namespace:NoesisGUIExtensions;assembly=Noesis.GUI.Extensions">
  <Grid.Resources>
    <Storyboard x:Key="anim" .../>
  </Grid.Resources>
  <b:Interaction.Triggers>
    <noesis:DataEventTrigger Source="{Binding}" EventName="DownloadFinished">
      <b:ControlStoryboardAction Storyboard="{StaticResource anim}"/>
    </noesis:DataEventTrigger>
  </b:Interaction.Triggers>
</Grid>