Microsoft 9GD00001 Computer Accessories User Manual


 
414 Microsoft Visual Studio 2010: A Beginner’s Guide
TIP
VS provides XAML editor support by allowing you to place your cursor between begin
and end tags, pressing
ENTER, and indenting the start position of the cursor on the new
line between the start and end tags. From that point, you can type < and begin working
with Intellisense to select the element and attribute you need to implement with property
element syntax.
Markup Extensions
Another extensibility point in XAML is markup extensions, which allow you to set an
attribute to reference another value. Common uses of markup extensions include data
binding and resource usage. Data binding is the practice of associating data with a user
interface control. For example, if you needed to show a customer record on the screen,
you would bind each property of the customer object to parts of the screen, such as
binding a customer name to a TextBox on the screen. You’ll see examples of data binding
in the WPF and Silverlight chapters of this book, Chapters 8 and 10. Right now, it’s
important to concentrate on what a markup extension is, and you’ll see an example that
applies a resource to an element.
A resource is some type of object or value that can be used by multiple controls. For
example, you can define a special color for buttons on your screen in one place and then
use a markup extension to point all of these buttons to the same resource. That way
, you
can change the color resource in one place and all buttons referring to that color resource
Figure B-3 Button with Content property element set to Image