Introduction
Throughout the two previous chapters, we learned how to lay out our applications and add some simple animations to them. We have added some simple interactivity using both events and behaviors. Events are a classic way of adding interactivity, and if you have any background in WinForms development, then you will be used to this type of development. But with Silverlight, you will find that behaviors tend to lend themselves to an easier way of doing things by allowing you to define a majority of things directly in the XAML.
Essentially, behaviors are a way to attach an action to an event of a control without having to write code in your code behind. This is great for assigning events like NavigateToPage
or PlaySound
, which can be a few lines of code in your code behind, when you can just drag-and-drop the behavior onto the design surface and have a much richer editing experience.