Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Silverlight4
what are the diferences among Behaviours ,triggers, Action.
 

i have read many articalls about this but iam unable to understand what are basic differences among them . when should i go for those in silver light
 
Please help me any one
Posted 21-Jun-12 17:32pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

TRIGGERS & ACTIONS
 
Think of the following sentence:
 
When I press the button, the door opens.
 
This sentence includes
an action, the opening off the door, and
a trigger that causes the action to happen, pressing the button.
 
And that really is all an Action is:
An activity in the most general sense. We will have built-in Actions that do common things such as playing storyboards, setting properties, setting state and many more, but really, an Action can do anything someone decides to write. Your imagination is the limit.
 
Just like Actions, Blend 3 will supply built-in Triggers, for example for common events.
And again, Triggers are extensible so the community can create new ones.
Here are a few examples for possible Triggers:
TimerTrigger fires when a timer expires.
 
You could have triggers 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.
 
BEHAVIORS
 
There are many bits of interactivity that cannot easily be encapsulated with Triggers and Actions.
 
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.
Behaviors 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[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 398
1 CPallini 333
2 George Jonsson 270
3 OriginalGriff 159
4 Prasad Khandekar 135
0 OriginalGriff 4,613
1 CPallini 3,340
2 Sergey Alexandrovich Kryukov 2,771
3 George Jonsson 2,254
4 Gihan Liyanage 2,020


Advertise | Privacy | Mobile
Web04 | 2.8.140905.1 | Last Updated 22 Jun 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100