Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Application.Resources Property

Gets or sets a collection of application-scope resources, such as styles and brushes.

Namespace:  System.Windows
Assembly:  PresentationFramework (in PresentationFramework.dll)

public ResourceDictionary Resources { get; set; }
    <ResourceDictionary .../>

Property Value

Type: System.Windows.ResourceDictionary
A ResourceDictionary object that contains zero or more application-scope resources.

The Resources property can be used to share resources across the windows and elements of an application. Additionally, the Resources property is included in the resource lookup path, which is traversed in the following order:

  1. Elements

  2. Windows

  3. Application.Resources

  4. System

Consequently, user interface (UI) elements can bind to application-scope resources. Additionally, if resources change, the resource system ensures that element properties which are bound to those resources are automatically updated to reflect the change.

Application-scope resources provide a simple way to support a consistent theme across your application. You can easily create a theme in XAML by using the Application.Resources tag. However, if your application supports multiple themes, which may contain a large number of theme elements, it might be easier to manage them using one ResourceDictionary instance for each theme. In this way, a new theme can be applied by setting the Resources property to the appropriate ResourceDictionary.

Resources is thread safe and is available from any thread.

This example illustrates how to use XAML together with application-scope resources to create a consistent visual appearance.


    <SolidColorBrush x:Key="BackgroundColor" Color="Yellow"></SolidColorBrush>


    Background="{StaticResource BackgroundColor}"



.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
© 2018 Microsoft