Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I did this by a using DataTrigger and binding it to a property in my ViewModel. When the "FlashingBackGround" property gets set to "ON" the Storyboard animation starts.</p> <p>Also make sure to include in your project a reference to "Microsoft.Expression.Interactions"</p> <p>XAML: (this goes directly in the root node)</p> <pre><code>&lt;Window xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" x:Name="window" &gt; ... &lt;i:Interaction.Triggers&gt; &lt;ei:DataTrigger Binding="{Binding FlashingBackground, Mode=OneWay}" Value="ON"&gt; &lt;ei:ControlStoryboardAction Storyboard="{StaticResource MyAnimation}" ControlStoryboardOption="Play"/&gt; &lt;/ei:DataTrigger&gt; &lt;/i:Interaction.Triggers&gt; ... &lt;/Window&gt; </code></pre> <p>ViewModel:</p> <pre><code> private void TurnOnFlashingBackround() { FlashingBackground = "ON"; } private string _FlashingBackround = "OFF"; public string FlashingBackground { get { return _FlashingBackround; } private set { if (FlashingBackground == value) { return; } _FlashingBackround = value; this.OnPropertyChanged("FlashingBackground"); } } public new event PropertyChangedEventHandler PropertyChanged; private void OnPropertyChanged(string propertyName) { if (this.PropertyChanged != null) { this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } </code></pre> <p>Finally, the Viewmodel must inherit from "INotifyPropertyChanged"</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload