title: XAML Without WPF - Animations
body: <p>I am trying to use XAML completely outside WPF, in particular inside an XNA application. So far, I have managed (quite easily, I am surprised to admit) to load some data inside my XNA application from a XAML file. The problems start when I decided that I wanted to animate one of the properties of my class...Nothing happens :(</p>
  
  <p>Here is the main class I load from the XAML file:</p>
  
  <pre><code>[ContentPropertyAttribute("Animation")]
  public class Test : FrameworkContentElement
  {
    public string Text { get; set; }
    public Vector2 Position { get; set; }
    public Color Color { get; set; }
    public Storyboard Animation { get; set; }
  
    public static DependencyProperty RotationProperty = 
      DependencyProperty.Register("Rotation", typeof(double), typeof(Test), new PropertyMetadata(0.0));
    public double Rotation { get { return (double)GetValue(RotationProperty); } set { SetValue(RotationProperty, value); } }
  }
  </code></pre>
  
  <p>Here is the XAML file:</p>
  
  <pre><code>&lt;l:Test xmlns:l="clr-namespace:XAMLAndXNA;assembly=XAMLAndXNA"
        xmlns:a1="clr-namespace:System.Windows.Media.Animation;assembly=PresentationFramework"
        xmlns:a2="clr-namespace:System.Windows.Media.Animation;assembly=PresentationCore"
    Text="Testo" Position="55,60" Color="0,255,255,255"&gt;
    &lt;a1:Storyboard&gt;
      &lt;a2:DoubleAnimation a1:Storyboard.TargetProperty="Rotation"
                                From="0"
                                To="360"
                                Duration="00:00:10.0"/&gt;
    &lt;/a1:Storyboard&gt;
  &lt;/l:Test&gt;
  </code></pre>
  
  <p>And here is the loading and animation launching (attempt):</p>
  
  <pre><code>Test test = XamlReader.Load(new XmlTextReader("SpriteBatchStuff.xaml")) as Test;
  test.Animation.Begin(test);
  </code></pre>
  
  <p>I am <em>dying</em> of curiosity :)</p>