title: WPF Keyframe Binding
body: <p>I have a bar chart that animates to the value set. The animation code looks like</p>
  
  <pre><code>&lt;UserControl.Resources&gt;
      &lt;Storyboard x:Key="BootUp"&gt;
          &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="MainBar"&gt;
              &lt;EasingDoubleKeyFrame KeyTime="0" Value="350"/&gt;
              &lt;EasingDoubleKeyFrame KeyTime="0:0:1" Value="{Binding CurrentValue, ElementName=UserControl}"/&gt;
          &lt;/DoubleAnimationUsingKeyFrames&gt;
      &lt;/Storyboard&gt;
  &lt;/UserControl.Resources&gt;
  </code></pre>
  
  <p>and the C#</p>
  
  <pre><code>int ThisValue=200;
  public int CurrentValue
  {
      get { return (int)ThisValue; }
      set { 
              ThisValue=(int)value;
              this.MainBar.ToolTip=value.ToString();
              System.Windows.Media.Animation.Storyboard storyBoard = (System.Windows.Media.Animation.Storyboard)FindResource("BootUp");
              storyBoard.Begin(this);
          }
  
  }
  </code></pre>
  
  <p>I think this should work but every time it returns</p>
  
  <pre><code>System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=UserControl'. BindingExpression:Path=CurrentValue; DataItem=null; target element is 'EasingDoubleKeyFrame' (HashCode=27594380); target property is 'Value' (type 'Double')
  </code></pre>
  
  <p>What is going on?</p>