CREATING XAML WITH VISUAL STUDIO
In this chapter, you??™ll take a look at all the details of XAML markup. Of course, when you??™re designing an
application, you won??™t write all your XAML by hand. Instead, you??™ll use a tool such as Visual Studio to drag
and drop your windows into existence. Based on that, you might wonder whether it??™s worth spending so
much time studying the syntax of XAML.
The answer is a resounding yes. Understanding XAML is critical to WPF application design. WPF applications
are quite different from Windows Forms applications in this respect??”with Windows Forms
applications, you could safely ignore the automatically generated UI code, while in WPF applications the
XAML often takes center stage. Understanding XAML will help you learn key WPF concepts, such as
attached properties (in this chapter), layout (Chapter 4), the content model (Chapter 5), routed events
(Chapter 6), and so on. More important, there is a whole host of tasks that are only possible??”or are far
easier to accomplish??”with handwritten XAML. They include the following:
23
C H A P T E R 2
??? Wiring up event handlers. Attaching event handlers in the most common places??”for example, to the
Click event of a Button??”is easy to do in Visual Studio. However, once you understand how events are
wired up in XAML, you??™ll be able create more sophisticated connections.
Pages:
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113