我得到了一个ControlTemplate和TargetProperty="Button",它使用VisualStateManager,除了BitmapIcon.Foreground属性的ColorAnimation之外,一切都很正常。
我把它设置成这样:
<ColorAnimation Storyboard.TargetName="PART_Icon"
Storyboard.TargetProperty="(BitmapIcon.Foreground).(SolidColorBrush.Color)"
To="Green"
Duration="0:0:0.100" />我按下按钮什么都不会发生。对于给定的ColorAnimations,StoryBoard中的所有其他VisualState都是有魅力的。
将其设置为旧的方式是从代码背后的事件中产生的,但是它的代码很多。
发布于 2016-02-15 09:53:34
由于位图标的前台属性,上述代码的颜色动画来自于偶像元素类。
尝试以下代码:
<ColorAnimation Storyboard.TargetName="PART_Icon"
Storyboard.TargetProperty="(IconElement.Foreground).(SolidColorBrush.Color)"
To="Green"
Duration="0:0:0.100" />希望它能像魅力一样运作。:)
发布于 2016-02-15 10:01:17
将EnableDependentAnimation设置为True
<ColorAnimation Storyboard.TargetName="PART_Icon"
Storyboard.TargetProperty="(BitmapIcon.Foreground).(SolidColorBrush.Color)"
To="Green"
EnableDependentAnimation="True"
Duration="0:0:0.100" />https://stackoverflow.com/questions/35350771
复制相似问题