Windows Phone 8.1 RT 颜色动画

Windows Phone 8.1 RT ColorAnimation

我有一个 ControlTemplateTargetProperty="Button",它使用 VisualStateManager,除了 BitmapIcon.Foreground 属性 的 ColorAnimation 之外,一切正常.

我是这样设置的:

<ColorAnimation Storyboard.TargetName="PART_Icon" 
                Storyboard.TargetProperty="(BitmapIcon.Foreground).(SolidColorBrush.Color)" 
                To="Green"
                Duration="0:0:0.100" />

按下按钮时没有任何反应。对于给定的 VisualStateStoryBoard 中的所有其他 ColorAnimations 都非常有效。

以旧方式设置它适用于代码隐藏中的事件,但它的代码很多。

上面代码的彩色动画是因为bitmapicon的前景属性来自iconelementclass。

试试下面的代码:

<ColorAnimation Storyboard.TargetName="PART_Icon" 
            Storyboard.TargetProperty="(IconElement.Foreground).(SolidColorBrush.Color)" 
            To="Green"
            Duration="0:0:0.100" />

希望它像魅力一样有效。 :)

设置 EnableDependentAnimationTrue

<ColorAnimation Storyboard.TargetName="PART_Icon" 
                Storyboard.TargetProperty="(BitmapIcon.Foreground).(SolidColorBrush.Color)" 
                To="Green"
                EnableDependentAnimation="True"
                Duration="0:0:0.100" />