15.02.2015 Views

C# 4 and .NET 4

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Controls ❘ 995<br />

simPle ConTrol<br />

PasswordBox<br />

ScrollBar<br />

ProgressBar<br />

Slider<br />

TextBox<br />

RichTextBox<br />

Calendar<br />

DatePicker<br />

desCriPTion<br />

This control is used to enter a password <strong>and</strong> has specifi c properties for password<br />

input, for example, PasswordChar, to defi ne the character that should show up as<br />

the user enters the password, or Password to access the password entered. The<br />

PasswordChanged event is invoked as soon as the password is changed.<br />

This control contains a Thumb where the user can select a value. A scrollbar can be used,<br />

for example, if a document doesn’t fi t on the screen. Some controls contain scrollbars that<br />

show up if the content is too big.<br />

With this control, you can indicate the progress of a lengthy operation.<br />

With this control, the user can select a range of values by moving a Thumb. ScrollBar,<br />

ProgressBar, <strong>and</strong> Slider are derived from the same base class, RangeBase.<br />

Used to display simple, unformatted text.<br />

Supports rich text with the help of the FlowDocument class. RichTextBox <strong>and</strong><br />

TextBox are derived from the same base class, TextBoxBase.<br />

The Calendar control is new with .<strong>NET</strong> 4 — it displays a month, year, or decade. The<br />

user can select a date or range of dates.<br />

The DatePicker is a control that opens a Calendar onscreen for date selection by the user.<br />

Although simple controls do not have a Content property, you can completely<br />

customize the look of the control by defi ning a template. Templates are discussed later<br />

in this chapter.<br />

Content Controls<br />

A ContentControl has a Content property, with which you can add any content to the control. The Button<br />

class derives from the base class ContentControl , so you can add any content to this control. In a previous<br />

example, you saw a Canvas control within the Button . Content controls are described in the following table.<br />

ConTenTConTrol ConTrols<br />

Button<br />

RepeatButton<br />

ToggleButton<br />

CheckBoxRadioButton<br />

Label<br />

Frame<br />

ListBoxItem<br />

StatusBarItem<br />

ScrollViewer<br />

ToolTip<br />

desCriPTion<br />

The classes Button, RepeatButton, ToggleButton, <strong>and</strong><br />

GridViewColumnHeader are derived from the same base class,<br />

ButtonBase. All buttons react to the Click event. The RepeatButton<br />

raises the Click event repeatedly until the button is released.<br />

ToggleButton is the base class for CheckBox <strong>and</strong> RadioButton. These<br />

buttons have an on <strong>and</strong> off state. The CheckBox can be selected <strong>and</strong><br />

cleared by the user; the RadioButton can be selected by the user. Clearing<br />

the RadioButton must be done programmatically.<br />

The Label class represents the text label for a control. This class also has<br />

support for access keys, for example, a menu comm<strong>and</strong>.<br />

The Frame control supports navigation. You can navigate to a page content<br />

with the Navigate() method. If the content is a Web page, then the Web<br />

browser control is used for display.<br />

ListBoxItem is an item inside a ListBox control.<br />

StatusBarItem is an item inside a StatusBar control.<br />

The ScrollViewer control is a content control that includes scrollbars. You<br />

can put any content in this control; the scrollbars will show up as needed.<br />

ToolTip creates a pop-up window to display additional information for a<br />

control.<br />

continues<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!