2016-02-11 102 views
0

我买了一个TargetProperty="Button"其中ControlTemplate使用VisualStateManager,一切工作正常,除了ColorAnimationBitmapIcon.Foreground财产。的Windows Phone 8.1 RT ColorAnimation

我设置这样的:当我按下按钮

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

什么也没有发生。所有其他ColorAnimationsStoryBoard给定VisualState作品像一个魅力。

设置旧的方式从代码隐藏事件,但它的代码很多工作。

回答

0

颜色动画上述代码因为bitmapicon的前景属性来自iconelement类。

试试下面的代码:

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

希望工程般的魅力。 :)

+0

它不工作。 – CodeMonkey

+0

你可以发布代码吗? –

+0

也许你可以将位图图标作为按钮的内容,并尝试按钮的内容展示器的动画颜色。 –

0

设置EnableDependentAnimationTrue

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

我已经试过了。还是行不通。 – CodeMonkey

+0

你能提供完整的xaml代码吗?按钮和样式 –

相关问题