Qwertie
Qwertie

Reputation: 17186

WPF: Are 'automatic' animations possible?

I have an ItemsControl that shows items using DataTemplates. When certain properties of the items change, I would like the changes to appear animated in the ItemsControl. For instance, an item has a Thickness and a Color and when these properties change, I would like to show an animation transitioning from one to the other. What is the easiest way to do this?

Upvotes: 1

Views: 224

Answers (1)

rmoore
rmoore

Reputation: 15393

I think you could do this through using a Trigger's EnterActions and ExitActions.
You could use these with a standard trigger if the properties are a part of the control, or with a DataTrigger if the properties exist on the Items that you are templating. While they need a set value for the Value property to fire the actions, you can use a ValueConverter or a MultiValueConverter to transform your values to something more useable by the triggers.

Upvotes: 1

Related Questions