Microsoft 9GD00001 Computer Accessories User Manual


 
218 Microsoft Visual Studio 2010: A Beginner’s Guide
Key Skills & Concepts
Perform Screen Layout
Use Controls
Work with Data in the UI
W
indows Presentation Foundation (WPF) is a .NET technology for building desktop
applications. The result of building a WPF application is an *.exe file that you can
run directly on your computer or deploy and run on any other computer that has .NET
installed. With WPF, you can add a graphical user interface (GUI), pronounced “Gooey,”
that makes it easier for users to work with your program. This chapter will show you how
to lay out a screen in WPF and explain the controls, such as Button and TextBox, that you
can place on the screen. You’ll also learn how to capture events off controls, allowing you
to add code that runs based on user input. Since most applications work with data, this
chapter builds on what you learned in Chapter 7 and shows how to bind data to controls in
the GUI.
This chapter will show you how to build a WPF GUI with the VS Designer, but
sometimes you must work at a lower level and manipulate the XAML, pronounced
“Zammel,” that defines the GUI. XAML is an XML format that WPF and Silverlight
use to define a GUI. There are two appendixes in this book that will help you get up to
speed in XAML: Appendix A, “Introduction to XML,” and Appendix B, “Introduction to
XAML.” If you aren’t familiar with XML, start with Appendix A. However, if you have
a good grasp of basic XML syntax, go straight to Appendix B. I’ll try to explain WPF in
a way that any XAML you see can be understood in its context, but you might want to
review the appendixes to avoid any confusion. Once you’re familiar with XAML, you can
return here and start with the next section, which explains how to start a WPF project.
Starting a WPF Project
In Chapter 5, you learned how to create and build projects. The example explained how
to create a Console application. However, what you learned there is generally applicable
to most other application types. This section builds upon what you already know about
projects and explains what is unique to a WPF application. To get started, open the New
Project window; select WPF Application; and fill in the project name, location, and