O'Reilly logo

MCTS: Microsoft Silverlight 4 Development (70-506) Certification Guide by Johnny Tordgeman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing behaviors

Behaviors were introduced in Silverlight 3 and provide a new way of adding interactivity to UI elements without the use of code. Behaviors are reusable pieces of code that extend either a specific UI element (for example, TextBox) or a whole type of elements (for example, FrameworkElement). Behaviors are basically self-contained pieces of functionality that go along with the object they are attached to and react to its environment. Behaviors contain two important elements—Trigger and Action. Trigger elements are used to invoke an action. Take, for example the PlaySoundAction behavior that comes bundled with Expression Blend 4. When adding this behavior, you need to set a trigger (when will the sound be played) such as MouseLeftButtonDown ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required