CONTROLS OVERVIEW

You can group WPF controls into several categories. Some of these correspond naturally to the purposes of Windows Forms controls. Other categories play a more important role in WPF than they do in Windows Forms applications.

In particular, WPF controls rely heavily on layout controls that arrange and organize the controls that they contain. Windows Forms developers often simply arrange controls on a form with fixed sizes and positions. A WPF application is more likely to arrange the controls in a hierarchy of StackPanel and Grid controls and let those controls arrange their contents.

The recent proliferation of screen formats makes this idea more important than ever. If you write programs running on everything from traditional desktop systems to Windows 8 tablets, your programs will need the ability to rearrange their controls automatically. A smartphone can even switch from portrait to landscape orientation while a program is running, so the program must respond to make effective use of the available space. I won’t claim that most applications should be able to run on a tiny phone screen or a 17″ laptop without any changes, but good use of container controls can simplify some of the changes you’ll need to make.

The following sections describe the main categories of WPF controls. The example programs for this chapter, which are available on the book’s website, demonstrate many of the controls’ basic uses.


CONCEALED CONTROLS
Not all of the controls described here are available by default when you create a new WPF application. You need to add some of these controls to the Toolbox before you can use them. To add a control that is missing, right-click a Toolbox section and select Choose Items. On the Choose Toolbox Items dialog box, select the WPF Components tab, check the boxes next to the controls that you want, and click OK.
Note, also, that some additional controls may be available in the Choose Toolbox Items dialog box that are not described here. The following sections describe only the most commonly used controls.

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

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