Chapter 8. Programming .NET Silverlight Applications

This chapter covers how to take advantage of the relationship between XAML and code-behind pages to build .NET Silverlight programs. Using .NET languages such as C# and Visual Basic enables you to do almost everything you need to generate impressive interfaces using Silverlight.

This chapter focuses on three main areas to illustrate how to use .NET languages to provide a rich interface for users. The first section covers manipulating the XAML elements programmatically to show you how to use code-behind pages to generate user interface functionality. The next section discusses event handling to handle user and program events to implement a very dynamic user interface. The final section discusses using code-behind pages to create robust functionality in your animations.

Manipulating XAML Elements Programmatically

A very useful feature of code-behind pages when programming .NET Silverlight applications is the ability to access and manipulate the controls defined by XAML elements. XAML is very limited when it comes to providing functionality to a Web site. That is where the code-behind pages come in. With the code-behind pages, you can programmatically access XAML elements to modify the user interface dynamically to provide a much better experience for the user.

The following sections take you through the basics of accessing XAML elements, creating new XAML elements, and deleting existing XAML elements.

Accessing namescoped XAML elements ...

Get Silverlight™ 2 Bible 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.