Datasheet
Using styles and templates
Maintaining consistency in your application is an essential part of making your user interface
design highly usable. To aid your efforts in balancing the consistency and interactivity that you
need in your interface, you can create and use styles and templates in Blend. You can add anima-
tions to styles or you can add property triggers to trigger the change in appearance of a style due to
a property change for its object type, such as when the mouse is over the control, or when it is
pressed. Blend also offers templates to define the control parts of a control, and how the control
parts respond interactively to property changes and events. Using a template, you can define a con-
trol that appears radically different from its default WPF control, yet consistently maintains that
new look.
You can make styles and templates available as resources within a single window, or within the
entire application, or save them in resource dictionaries and make them available to other applica-
tions as well. Styles, templates, and resource dictionaries provide you with a way to extend the
flexibility of your design, because changing a style or template can result in immediately changing
every instance of that style or template.
Linking to data
Using Blend, you can link your controls to different sources of data. For example, you can link
your controls to data from RSS feeds, and you can also link to data in databases. Blend allows you
to link to two kinds of data formats: Common Language Runtime (CLR) Objects and Extensible
Markup Language (XML).
n
CLR Objects are data items that are usually stored in an ObservableCollection object in the
code-behind files. You can read in data from a database into a data table in the code-
behind file, and then convert it into an ObservableCollection. Then it can be added as a
CLR Object data source in the Data palette of Blend and linked to controls.
n
XML, as noted earlier in this chapter, is similar to HTML except that it is extensible.
Because it is extensible, the user can create custom tags for data according to certain rules
so that the data can be more easily understood by other computer software. These tags
can be, for example, the names of fields in your database. You can link to a database and
bind controls, such as a list box or combo box, to any field or fields of the database. In
Figure 1.14, for example, an XML data source supplies information from Wikipedia.
For more information on linking controls to data sources, see Chapter 21.
For a great example of how powerful flow documents can be, especially when linked to
data sources, go to
http://firstlook.nytimes.com/ and check out the New
York Times Reader.
ON
the
WEB
ON
the
WEB
CROSS-REF
CROSS-REF
18
Designing Next-Generation User Experiences
Part I
05_055038 ch01.qxp 5/4/07 8:58 PM Page 18










