6. Resources
WPF offers us great flexibility in how we construct an
application's user interface. But with great power comes great responsibilitywe
must avoid bewildering the user with a garish and inconsistent frontend. An
application's user interface should be internally consistent, and while some
applications differentiate themselves visually, most should be consistent with
the look and feel of the user's chosen operating system visual theme.
We've already seen how styling and templates allow us to take
control of our application's visuals. These features depend on the resource
system in WPF to make it easy to build visually consistent applications without
sacrificing flexibility. If you want to build a graphically distinctive
application, the resource system provides a straightforward way to
skin your applications with customized yet consistent visuals. But,
by default, the resource mechanism simply ensures consistency with the
system-wide OS theme chosen by the user.
In this chapter, we will look at how the resource system lets us
plug in visual features where they are needed. Not only will we see how to
ensure that the right look and feel is applied to our application at runtime,
we will also look at how the resource system lets you reuse objects or groups
of objects such as drawings in multiple places in your application.
Additionally, we'll look at how to use the resource facilities to manage binary
streams and how to make our applications localizable.
 |