自定义类的动画属性

时间:2016-02-23 02:35:43

标签: c# xaml animation win-universal-app dependency-properties

在我的UWP项目中,我将页面上的几个元素绑定到各种对象,然后更新。其中一个对象是一个带有附加DependencyProperty的自定义类,称为Background。在我的班级中,背景被定义为SolidColorBrush。

当直接为元素的背景设置动画时,例如,按钮,我会使用:

Storyboard.SetTargetProperty(animation, "(Button.Background).(SolidColorBrush.Color)");

因此,在尝试设置自定义类的Background属性的动画时,我写道:

Storyboard.SetTargetProperty(animation, "(MyClass.Background).(SolidColorBrush.Color)");

这给了我错误:

Cannot resolve TargetProperty (MyClass.Background).(SolidColorBrush.Color)

如何正确设置自定义类的dependencyproperty动画?

0 个答案:

没有答案