Chapter 16. Making the Application Come Alive

Now that you have a good understanding of Silverlight application structure and architecture, have learned how to hook up your data, and have a good grasp on creating and styling your UI, it's time to take it to the next level and really make your application come alive. In this chapter, we dive into the facilities that Silverlight provides for you to make your application interactive.

Events

To start off, we'll dive into eventing, particularly event interop between JavaScript and your managed code.

Most of the interop with the browser (from managed code) is achieved through the Browser namespace, so you'll want to include using a System.Windows.Browser; statement when using it, as I've done in the samples in this chapter.

Note

Before moving on, many of the samples in the rest of this chapter do not require a corresponding web site, so we're not going to generate or use a web app (or site) for our Silverlight solutions. By default, the other option when creating a Silverlight Application in Visual Studio is to dynamically generate a test HTML page for the Silverlight app. This would be fine, except that we need to write some JavaScript and other interaction, so what we'll do is tweak the default single-project Silverlight setup.

Raising and Handling Managed Events in Script

If you've done any .NET development, you're already familiar with handling managed events, so here we're going to focus on two things: raising managed events and handling ...

Get Silverlight™ 3 Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.