Working with Resources and Resource Dictionaries

Resources are essentially reusable objects and values, somewhat similar in concept to constants in code Resources are ideal for when you want to define a commonly used value once and use it multiple times in your XAML. The advantage of defining a value as a resource is that when you want to change that value, the change can be made in just one place, and it will be automatically applied to all the controls that reference it—making your application much easier customize and maintain.

For example, let's say you have multiple controls that all use the same color as their background:

<TextBox Background="LemonChiffon" /> <ComboBox Background="LemonChiffon" /> <CheckBox Background="LemonChiffon" /> ...

Get Pro Business Applications with Silverlight 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.