
416Microsoft Visual Studio 2010: A Beginner’s Guide
Figure B-4 Two Buttons using the same resource via a markup extension
StaticResource markup extension. Further, think about the amount of work you would need to do if you wanted to change the background color of all buttons, resulting in recoding each individual button. However, with the StaticResource markup extension, you can change the color in the SolidColorBrush resource, and the BackGround of all buttons will change without any additional work. Figure
Summary
This appendix introduced you to XAML, which is the XML document type used to build user interfaces for WPF and Silverlight. You learned that elements map to classes and attributes map to class properties. You also learned how to specify property elements
to gain more control than what you can get with attributes alone. Finally, you learned about the syntax of a markup extension and how the StaticResource markup extension allows you to reference resources. You’re now ready to approach the WPF and Silverlight chapters in this book, which use XAML heavily to build their user interfaces.