title: Update property in ViewModel during DoubleAnimation in WPF
body: <p>I have WPF solution which uses MVVM pattern. It contains ViewModel <em>BlockViewModel</em>:</p>
  
  <pre><code>public class BlockViewModel:ViewModelBase
  {
      private double _top;
      public double Top
      {
          get
          {
              return _top;
          }
          set
          {
              if (_top == value)
              {
                  return;
              }
              _top = value;
              OnPropertyChanged("Top");
          }
      }
  
      private bool _isAnimated;
      public bool IsAnimated
      {
          get { return _isAnimated; }
          set
          {
              if (_isAnimated == value)
              {
                  return;
              }
              _isAnimated = value;
              OnPropertyChanged("IsAnimated");
          }
      }
  
  }
  </code></pre>
  
  <p>And UserControl <em>BlockView</em>:</p>
  
  <pre><code>&lt;UserControl 
               x:Class="BlockGame.Wpf.Views.BlockView"
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
               xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
               xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
               xmlns:converters="clr-namespace:BlockGame.Wpf.Converters"
               xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
               xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
               xmlns:blocks="clr-namespace:BlockGame.ViewModels.Blocks;assembly=BlockGame.ViewModels"
  
               mc:Ignorable="d"
               d:DataContext="{d:DesignInstance Type=blocks:BlockViewModel, IsDesignTimeCreatable=True}"
               &gt;
      &lt;UserControl.Resources&gt;
          &lt;Storyboard x:Key="BlockStoryboard"&gt;
              &lt;DoubleAnimation x:Name="StoryboardAnimation" Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)" Storyboard.TargetName="Border" From="0" To="100" Duration="0:0:5" /&gt;
          &lt;/Storyboard&gt;
  
      &lt;/UserControl.Resources&gt;
  
      &lt;Border Width="100" Height="50" Name="Border" Background="Lavender" BorderThickness="1" BorderBrush="Black"&gt;
  
          &lt;Border.RenderTransform&gt;
              &lt;TranslateTransform X="20" Y="{Binding Top}" /&gt;
          &lt;/Border.RenderTransform&gt;
  
          &lt;i:Interaction.Triggers&gt;
              &lt;ei:DataTrigger Binding="{Binding IsAnimated}" Value="True"&gt;
                  &lt;ei:ControlStoryboardAction Storyboard="{StaticResource BlockStoryboard}" /&gt;
              &lt;/ei:DataTrigger&gt;
              &lt;ei:DataTrigger Binding="{Binding IsAnimated}" Value="False"&gt;
                  &lt;ei:ControlStoryboardAction Storyboard="{StaticResource BlockStoryboard}" ControlStoryboardOption="Pause" /&gt;
              &lt;/ei:DataTrigger&gt;
          &lt;/i:Interaction.Triggers&gt;
  
      &lt;/Border&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>Is there any way to update Top property during animation?</p>
  
  <p><strong>UPDATE</strong>  </p>
  
  <p>It seems I found working solution:  </p>
  
  <pre><code>&lt;Border.RenderTransform&gt;
      &lt;TranslateTransform X="{Binding Left}" Y="0" x:Name="TranslateTransform" /&gt;
  &lt;/Border.RenderTransform&gt;
  &lt;i:Interaction.Triggers&gt;
           ...
      &lt;ei:PropertyChangedTrigger Binding="{Binding ElementName=TranslateTransform, Path=Y}"&gt;
          &lt;ei:ChangePropertyAction Value="{Binding ElementName=TranslateTransform, Path=Y}" PropertyName="Top" TargetObject="{Binding RelativeSource={RelativeSource  FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext}"&gt;&lt;/ei:ChangePropertyAction&gt;
      &lt;/ei:PropertyChangedTrigger&gt;
  &lt;/i:Interaction.Triggers&gt;
  </code></pre>