2012-06-13 29 views
1

错误:“属性背景的属性值无效。”C#WP7按钮按下状态抛出:“属性Background的属性值无效。”

XAML:

<VisualState x:Name="Pressed"> 
    <Storyboard> 
     .... 
     <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonBackground" Storyboard.TargetProperty="Background"> 
      <DiscreteObjectKeyFrame KeyTime="0" Value="/Images/home_2_click.png" /> 
     </ObjectAnimationUsingKeyFrames> 
     .... 
    </Storyboard> 
</VisualState> 
+1

看到这个问题http://stackoverflow.com/questions/9971506/why-isnt-my-windows-phone-silverlight-rotation-animation-working/9972220#9972220它也许类似 –

+1

罗马嗨,答案下面帮助我,但你的带领我一些很酷的动画相关的问题:)对未来的参考。 –

回答

2

你似乎动画过程中背景IMAG应用到一个按钮。 当然,你正在以一种错误的方式应用它。 您必须执行以下操作:

<DiscreteObjectKeyFrame KeyTime="0:0:1"> 
    <DiscreteObjectKeyFrame.Value> 
     <ImageBrush ImageSource="" /> 
    </DiscreteObjectKeyFrame.Value> 
</DiscreteObjectKeyFrame> 

这一定会解决您的问题。如果确实如此,请将此标记为已接受的答案。 感谢名单

+0

谢谢Uday !!这样做:D –