Referencing a ThemePack in XAML

Glossary Item Box

Infragistics(R) NetAdvantage(R) for WPF

Referencing a ThemePack in XAML

Since styling is such an important task in application development, the NetAdvantage for WPF controls all include built-in themes you can use for styling. In addition, NetAdvantage for WPF controls also have separate ThemePacks that are included in the installer. ThemePacks are simply compiled assemblies; which removes the complication of referencing one in your project.

Follow these steps to reference a ThemePack in your project.

  1. For easier access to the ThemePack, add the following namespace declaration inside the opening Page or Window tag.

    In XAML:

    xmlns:igThemesLipStick="http://infragistics.com/Themes/Lipstick"  
    

  2. Create a Resources section for the Page or Window and add a ResourceDictionary. The following XAML adds a ResourceDictionary to the Resources section of a Page.

    In XAML:

    <Page.Resources>
    	<ResourceDictionary>
          ...
    	</ResourceDictionary>
    </Page.Resources>
    

  3. Inside the ResourceDictionary, define a MergedDictionaries section.

    In XAML:

    <Page.Resources>
    	<ResourceDictionary>
    		<ResourceDictionary.MergedDictionaries>
            	...
    		</ResourceDictionary.MergedDictionaries>
    	</ResourceDictionary>
    </Page.Resources>
    

  4. The follow XAML adds style references for all the NetAdvantage for WPF controls. This would cause every NetAdvantage for WPF control on the Page to use the Lipstick ThemePack.

    In XAML:

    <Page.Resources>
    	<ResourceDictionary>
    		<ResourceDictionary.MergedDictionaries>
    			<!--Styles all controls using the LipStick ThemePack-->
    			<igThemesLipStick:DataPresenter />
    			<igThemesLipStick:Primitives  />
    			<igThemesLipStick:Editors  />
    		</ResourceDictionary.MergedDictionaries>
    	</ResourceDictionary>
    </Page.Resources>
    

  5. Once added to a Page with xamDataGrid™, you will see a pink theme similar to the screen shot below.

E-mail your feedback on this topic.

Opinion about our help? Take our survey.

Copyright © 2003-2007 Infragistics, Inc. All rights reserved.

Build Version: 7.1.20071.1320