title: VisualStateManager fails to start animation on UserControl
body: <p>I'm trying to start a animation on a UserControl using the VisualStateManager in a Windows Phone 7 Silverlight project but it won't work. GoToState just keep returning false.</p>
  
  <p>The code consists of a VisualState-behaviour which is running the GoToState when a State-property on the datacontext is changed, which happens when the button in the UI is clicked:</p>
  
  <p>What am I doing wrong?</p>
  
  <p>XAML:</p>
  
  <pre><code>    &lt;Grid&gt;
          &lt;UserControl x:Name="_testSubject" l:VisualStates.CurrentState="{Binding State}" /&gt;
          &lt;Button VerticalAlignment="Bottom" Content="Change state" Click="Button_Click" /&gt;
          &lt;VisualStateManager.VisualStateGroups&gt;
              &lt;VisualStateGroup&gt;
                  &lt;VisualState x:Name="State2"&gt;
                      &lt;Storyboard&gt;
                          &lt;ColorAnimation From="Red" To="Green" Duration="0:0:10" Storyboard.TargetProperty="Background" Storyboard.TargetName="_testSubject" /&gt;
                      &lt;/Storyboard&gt;
                  &lt;/VisualState&gt;
              &lt;/VisualStateGroup&gt;
          &lt;/VisualStateManager.VisualStateGroups&gt;
      &lt;/Grid&gt;
  </code></pre>
  
  <p>C#:</p>
  
  <pre><code>public class Test : INotifyPropertyChanged
  {
      public event PropertyChangedEventHandler PropertyChanged;
      void OnPropertyChanged(string name) { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(name)); }
      string _state;
      public string State { get { return _state; } set { _state = value; OnPropertyChanged("State"); } }
  }
  
  public static class VisualStates
  {
      public static readonly DependencyProperty CurrentStateProperty =
          DependencyProperty.RegisterAttached("CurrentState", typeof(String), typeof(VisualStates), new PropertyMetadata(TransitionToState));
  
      public static string GetCurrentState(DependencyObject obj)
      {
          return (string)obj.GetValue(CurrentStateProperty);
      }
  
      public static void SetCurrentState(DependencyObject obj, string value)
      {
          obj.SetValue(CurrentStateProperty, value);
      }
  
      private static void TransitionToState(object sender, DependencyPropertyChangedEventArgs args)
      {
          Control c = sender as Control;
          if (c != null)
          {
              bool b = VisualStateManager.GoToState(c, (string)args.NewValue, false);
          }
          else
          {
              throw new ArgumentException("CurrentState is only supported on the Control type");
          }
      }
  
  public partial class MainPage : PhoneApplicationPage
  {
      public MainPage() { InitializeComponent(); }
  
      private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
      {
          _testSubject.DataContext = new Test();
      }
  
      private void Button_Click(object sender, RoutedEventArgs e)
      {
          ((Test)_testSubject.DataContext).State = "State2";
      }
  }
  </code></pre>