Object Resources

Assembly resources are nothing new to .NET developers. However, WPF also introduces a new resource system that integrates closely with XAML. This system allows you to define resources in a variety of places in your markup (along with specific controls, in specific windows, or across the entire application) and then reuse it easily.

Object resources have a number of important benefits:

  • Efficiency. Resources let you define an object once and use it in several places in your markup. This streamlines your code and makes it marginally more efficient.

  • Maintainability. Resources let you take low-level formatting details (such as font sizes) and move them to a central place where they're easy to change. It's the XAML equivalent of creating ...

Get Pro WPF in C# 2008: Windows Presentation Foundation with .NET 3.5, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.