Chapter 9. Using Silverlight Controls

Usability studies show that users feel more comfortable with an application when they know intuitively how each of its UI elements is meant to be used. The same might be said for developers who can work more efficiently if their toolboxes are outfitted with controls that help them achieve a consistent look and feel and present their data in readable formats. Unlike its predecessor, which had none, Silverlight 2 comes with more than 20 such controls, depending on how you’re counting. You can write your own, of course, but usually you are better off at least starting with the ones that ship with the platform.

The new controls fall into roughly three categories: common UI controls, such as Button and TextBox; layout controls (technically, they are not controls at all, but panels), including Grid and StackPanel; and more complex controls, including DataGrid and ListBox.

All of the new controls are available in the Visual Studio 2008 Toolbox once the Microsoft Silverlight Tools for Visual Studio 2008 add-in has been installed. Expression Blend 2 SP1 also has support for the new controls.

You’ll learn about data binding later in Chapter 10. In Chapter 5, you were introduced to the new layout controls, Grid and StackPanel. In the remainder of this chapter, we’ll take a look at most of the new controls.

The TextBox Control

One of the elements most missed in Silverlight 1.0 was a textbox control. In Chapter 6 you learned how to implement your own text input ...

Get Essential Silverlight 2 Up-to-Date 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.