Visual studio 2010

Page 439

416

Microsoft 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 B-4 shows each of the buttons. Though you can’t tell the background color in the gray scale of this book, I promise that they are yellow.

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.


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.