views:

333

answers:

1

Hi everyone,

Let's say that I've defined a dependency like this:

     public class MySampleClass
    {public static DependencyProperty MyDoubleProperty = DependencyProperty.Register("MyDouble", typeof(double), typeof(MySampleClass));
    public double MyDouble
    {
        get
        {
            return (double)GetValue(MyDoubleProperty);
        }
        set
        {
            SetValue(MyDoubleProperty, value);
        }
    }
}

I'd like to apply a DoubleAnimation to this value. How can I do this? Always before, I've used DoubleAnimations by calling the BeginAnimation method of a UIElement.

Thanks for your help!

+1  A: 

Are you trying to use a DoubleAnimation on a class that doesn't inherit from UIElement? If not, you should at least inherit from Animatable, or some other base class which also supports BeginAnimation.

micahtan
Thanks, it seems to be working. I also had to override CreateInstanceCore(), for the record.