行为,触发器,动作之间有什么区别 [英] what are the diferences among Behaviours ,triggers, Action

查看:186
本文介绍了行为,触发器,动作之间有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

行为",触发器"和动作"之间有什么区别.


我已经读过很多关于此的文章,但是我无法理解它们之间的基本区别.我什么时候应该去买那些银色的东西

请帮助我任何一个

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

推荐答案

TRIGGERS&动作

想一下下面的句子:

当我按下按钮时,门就会打开.

这句话包括
action门的开口
trigger导致操作发生,按下按钮.

而这实际上是Action 的全部:
最一般意义上的活动.我们将拥有内置的Actions,可以执行一些常见的事情,例如播放故事板,设置属性,设置状态等等,但实际上,Action可以完成任何人决定编写的事情. 您的想象力是极限.

就像Actions一样,Blend 3将提供内置的Triggers,例如用于常见事件.
同样,Triggers是可扩展的,因此社区可以创建新的.
以下是一些示例(可能是Triggers的示例):
TimerTrigger在计时器到期时触发.

您可能有triggers会在数据库元素更改时触发.或当您的计算机上的网络连接断开时.
同样,只有您的想象力是极限.

行为

有很多交互性,很难用TriggersActions进行封装.

例如,如果要在画布上制作可拖动的内容,则需要至少处理三个事件:
您需要
-在按下鼠标时开始拖动
-在拖动过程中移动鼠标时更新-
-释放鼠标时终止拖动.

另外,您需要保留状态.这正是行为允许您执行的操作.
Behaviors使您可以将多个相关或从属活动加状态封装在单个可重用单元中.
参考资料:电力海滩的博客 [行为,触发器简介,和操作 [ WPF MVVM中的行为和动作触发器之间的区别 [ ^ ]
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[^]


外观 SilverLight常见问题解答第2部分 [ ^ ]
SilverLight的常见问题解答-第3部分 [有关WPF和Silverlight的重要FAQ问题 [ ^ ]
look SilverLight FAQ part 2[^]
SilverLight''s FAQ - Part 3[^]
Important FAQ questions for WPF and Silverlight[^]


这篇关于行为,触发器,动作之间有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆