Xceed Pro Themes for WPF v3.0 Documentation
Applying Themes Explicitly
Welcome to Xceed Pro Themes for WPF v3.0 > Basic Concepts > Applying Themes Explicitly

By default, Xceed's themes will be applied implicitly to any WPF control in your application (for details, see Applying Themes Implicitly).

If you do not wish our styles and brushes to automatically override your own, you must set StyleUsageMode of the theme resource dictionary to Explicit. This can be useful, for example, if you wish to apply Xceed's styles or brushes to your application selectively. However, when you have set StyleUsageMode to Explicit, the style or brush for each control must then be set manually.

Once you have added the references to the required assemblies to your project and declared the namespace maps that are to be used with the xmlns attribute (see Adding Xceed's Themes to Your Project), add the resource dictionary to the resources of the object you wish to style as follows, being sure to set StyleUsageMode to Explicit:

XAML
Copy Code
<Application.Resources>

    <xcpt:GlassResourceDictionary LicenseKey="XXXXX-XXXXX-XXXXX-XXXX" StyleUsageMode="Explicit" />

</Application.Resources>

Note that in order to use one of Xceed's themes, you must license it at this point. If the same type of ThemeResourceDictionary-derived resource theme is to be used more than once, the LicenseKey may be omitted subsequently. However, you must be sure to license the first theme resource dictionary that is loaded.

The Xceed styles and brushes you require must then be set explicitly. For example, the following sets the style of a button to the style available in Xceed's Glass theme:

XAML
Copy Code
<Button Style="{x:Static xcpt:GlassResources.ButtonStyle}"/>

If additional resources must be added at the same time as any Xceed theme resource dictionaries are added, the ResourceDictionary.MergedDictionaries property must be used:

XAML
Copy Code
<Window x:Class="WpfApplication1.Window1"

        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        xmlns:xcpt="http://schemas.xceed.com/wpf/xaml/themes"

        Title="Window1">

  <Window.Resources>

      <ResourceDictionary>

        <ResourceDictionary.MergedDictionaries>

            <xcpt:GlassResourceDictionary LicenseKey="XXXXX-XXXXX-XXXXX-XXXX" />

        </ResourceDictionary.MergedDictionaries>

        ... [Other resources]

      </ResourceDictionary>

  </Window.Resources>

  ...

Adding something to a theme resource dictionary will have absolutely no effect, and no error or exception will occur.

XAML
Copy Code
<ResourceDictionary>

  <ResourceDictionary.MergedDictionaries>

      <xcpt:MediaResourceDictionary>

        <Style TargetType="SomeControl">

            <Setter Property="Background"

                    Value="Black" />

        </Style>

        ...