O'Reilly logo

Silverlight™ 4 For Dummies® by Mahesh Krishnan, Phillip Beadle

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4. Working with Controls for UI Interactions

In This Chapter

  • Displaying text using TextBlock

  • Reading text input with TextBox

  • Triggering actions with Buttons

  • Making selections using RadioButtons, ListBoxes, and ComboBoxes

  • Entering rich text with RichTextBox

Most applications need to have some kind of interaction with the user to be useful. For example, if you are creating a business application, you need to provide a whole bunch of screens to collect information from a user. These screens may contain a number of fields that require user interaction — for example, you can accept textual input from the user, or the user can pick an item from a list or trigger an action by clicking a button.

In this chapter, you see how you can use TextBox to collect text input from the user and how you can use a RadioButton and ListBox to get the user to pick an item from a list, a button to perform an action, and so on.

Exploring the Text-Related Tools

There are four different text-related controls in Expression Blend, as follows:

  • TextBlock

  • TextBox

  • RichTextBox

  • PasswordBox

You use the TextBlock predominantly for displaying a label for an input field or just to display some information to the user. The TextBox, RichTextBox, and PasswordBox controls, on the other hand, allow the user to type in some text that is used as input to perform an operation. An example of an operation using a TextBox is getting the users to fill in their names. If you are writing an application that requires users to sign in using ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required