Before I start, I have this code inside of a Custom Usercontrol:
private DependencyProperty _rotation = DependencyProperty.Register("Rotation", typeof(double), typeof(MyControl),
new PropertyMetadata(new PropertyChangedCallback(RotationPropertyChanged)));
public double Rotation
{
get { return (double)GetValue(_rotation); }
set { SetValue(_rotation, value); }
}
public static void RotationPropertyChanged(DependencyObject obj, System.Windows.DependencyPropertyChangedEventArgs e)
{
//How can I start Animation, as I'm in a Static method?
}
The Properties are getting set correctly, and my RotationPropertyChanged Function is being called correctly as well. As you can see, my comment inside that method is my question. Since this handler NEEDS to be static (VS Told me so), How do I access Non-Static things, such as a storyboard so I can start animation?
To elaborate on the databinding:
My Viewmodel is updating a property(located in that same viewmodel) which is databound to this dependency property via Xaml. I wish I didn't have to use this callback, but the property wont be changed without it.
Thanks