Getting Started with Silverlight - Part 3/Page 2
Getting Started with Silverlight: Part 3
The most commonly used member on the Silverlight control is its
Content property, which represents the XAML content hosted by the control and exposes some interesting functionality. It has the following subproperties:
Content exposes three functions explained in Chapter 2, "XAML," and Chapter 8, "Downloading Content on Demand":
Content even exposes two unique events that cannot be consumed any other way. For example, you cannot specify either of these in the events array passed to createObject and createObjectEx. These two events are
A handler can be attached to either event by assigning a function reference. Listing 1.11 demonstrates this for the
In this example,
In addition to the Settings and Content properties, the Silverlight control defines three more properties:
The control also directly defines two functions:
The control also defines a single event—OnError—that is the same as the onError event described earlier. By assigning a function reference to the control's OnError member, you can change the default error handler at any time. Note that the control does not have an OnLoad member. You can only assign a handler for the onLoad event using the approaches discussed earlier.
As time passes, more software is targeted for the Web, and more software is expected to deliver high-quality—sometimes cinematic—experiences. However, the effort involved in creating such user interfaces has been far too difficult in the past.
If you're a software developer, you might be skeptical about the need for "eye candy" beyond what HTML provides. But like it or not, having an engaging user experience matters, whether you are creating a public consumer-facing site, or a simple intranet application for your manager. You can blame the unrealistic software on movies and on TV, or you can blame real-world software that is starting to catch up to Hollywood's standards! Indeed, modern software has more visual polish than it used to. You can see it in traditional operating systems (such as Mac OS X and, more recently, Windows Vista), in software for devices such as TiVo or Xbox, and of course all over the Web thanks to Adobe Flash. Users have increasing expectations for the experience of using software, and companies are spending a great deal of time and money on user interfaces that differentiate themselves from the competition. Microsoft understands this, and it's apparent in its latest technologies—first on the desktop with WPF, and now on the Web with Silverlight.
Printed with permission from Pearson Education from the book Silverlight 1.0 Unleashed written by Adam Nathan.