TRIGGERS & ACTIONS
Think of the following sentence:
When I press the button, the door opens.
This sentence includes
, the opening off the door
that causes the action to happen, pressing the button.
And that really is all an
An activity in the most general sense. We will have built-in
that do common things such as playing storyboards, setting properties, setting state and many more, but really, an
can do anything someone decides to write. Your imagination is the limit.
, Blend 3 will supply built-in
, for example for common events.
are extensible so the community can create new ones.
Here are a few examples
fires when a timer expires.
You could have
that fire when a data base element changes. Or when the network connection on your machine goes down.
Again, only your imagination is the limit
There are many bits of interactivity that cannot easily be encapsulated with
For example, if you want to make something drag-able on a canvas, you need to deal with at least three events
You need to
-begin a drag when the mouse is pressed,
-update when the mouse is moved during a drag, and
-terminate the drag when the mouse is released.
Also, you need to preserve state. And this is exactly what behaviors allow you to do.
let you encapsulate multiple related or dependent activities
plus state in a single reusable unit.
Ref.: electric beach's blog[^]
For more have a look on following threads:
AN INTRODUCTION TO BEHAVIORS, TRIGGERS, AND ACTIONS
Difference between Behaviors and Action triggers in WPF MVVM