MAKING SELECTIONS

Selection controls enable the user to choose values. If you use them carefully, you can reduce the chances of the user making an invalid selection, so you can reduce the amount of error-handling code you need to write.

The following table briefly describes the WPF controls that allow the user to select choices.

CONTROL PURPOSE
CheckBox Lets the user select an item or not. Each CheckBox choice is independent of all others.
ComboBox Displays items in a drop-down list. ComboBoxItem controls contain the items displayed in the list. (See example program UseComboBox, available for download on the book’s website.)
ComboBoxItem1 Holds the content for one ComboBox item.
ListBox Displays items in a list. ListBoxItem controls contain the items displayed in the list. The control automatically displays scroll bars when needed. (See example program UseListBox, available for download on the book’s website.)
ListBoxItem1 Holds the content for one ListBox item.
RadioButton Lets the user pick from among a set of options. If the user checks one RadioButton, all others with the same parent become unchecked. (See example program UseRadioButtons, available for download on the book’s website.)
ScrollBar Allows the user to drag a “thumb” to select a numeric value. Usually scroll bars are used internally by other controls such as the ScrollViewer, and your applications should use a Slider instead. (See example program UseScrollBar, available for download on the book’s website.)
Slider Allows the user to drag a “thumb” to select a numeric value. Similar to the Windows Forms TrackBar control. (See example program UseSlider, available for download on the book’s website.)

1 This control can hold only a single child.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.255.139