Kishore Kumar
Kishore Kumar

Reputation: 21863

How to assign static or dynamic Resource to Animation?

how can i assing static or dynaimc resource to animation. Eg how can i assign a brush resource to From or To property of ColorAnimation.

Upvotes: 0

Views: 244

Answers (1)

John Bowen
John Bowen

Reputation: 24453

ColorAnimation operates on Color objects, not Brush objects. If you're trying to use SolidColorBrush resources you can just change them to Color or change the brushes to reference new Color objects. Change:

<SolidColorBrush x:Key="MyBrush" Color="Red"/>

to

<Color x:Key="MyColor">Red</Color>
<SolidColorBrush x:Key="MyBrush" Color="{StaticResource MyColor}"/>

To="{StaticResource MyColor}"

Upvotes: 1

Related Questions