Button
の上にマウスがある場合、Button
のBackground
をアニメートしたいと思います。UserControlアニメーションボタンの背景
Button
さんBackground
私は今私のUserControl
... Background="{Binding BGColor, Elementname="QButton"}"
の背後にあるコードで作成したカスタム依存関係プロパティにバインドされて、私は
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation To="LightBlue"
Duration="0:0:2"
Storyboard.TargetProperty="Background.Color"/>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
を使用してボタンの背景をアニメーション化しようとした場合
例外が発生しました:
can not anima不変のプロパティ(またはそれに類するもの)。
この問題を解決するにはどうすればよいですか? マイクHillbergの素晴らしい記事をもとに
は
これらの[http://blogs.msdn.com/b/mikehillberg/archive/2006/09/26/cannotanimateimmutableobjectinstance.aspx](http://blogs.msdn.com/b/mikehillberg/archive /2006/09/26/cannotanimateimmutableobjectinstance.aspx)が役立つかもしれません[http://stackoverflow.com/questions/14383214/wpf-storyboard-in-style-returning-a-cannot-animate-color-on-an-immutable- obj](http://stackoverflow.com/questions/14383214/wpf-storyboard-in-style-returning-a-cannot-animate-color-on-an-immutable-obj) – spaceplane