Version

Referencing Your ThemePack

This is the sixth and final topic in a multi-part walkthrough that continues from Modifying the AssemblyInfo File. In this topic we will show how to reference the newly created ThemePack to style the xamDataGrid™.

  1. In the Solution Explorer, right click the solution and click Add, then click New Project… Name the project "ThemePackTestProject."

  2. Add a New Folder to the project called "Data" and place the Orders.xml file inside it.

  3. Add a NuGet package reference to the following:

    • Infragistics.WPF.DataGrids

    For more information on setting up the NuGet feed and adding NuGet packages, you can take a look at the following documentation: NuGet Feeds.

  1. Add a reference to the assembly that the MyThemePack project generated.

  2. In the Window1.xaml file, place the following namespace declaration inside the opening Window tag.

In XAML:

...
xmlns:igDP="http://infragistics.com/DataPresenter"
xmlns:igThemeOrangePeel="http://infragistics.com/Themes/OrangePeel"
...
  1. Create a Window Resources section defining a MergedDictionary object. This will expose all the styles from the ThemePack.

In XAML:

<Window.Resources>
        <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                        <igThemeOrangePeel:DataPresenter/>
                </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
</Window.Resources>
  1. Create a resources section for the Grid panel defining an XmlDataProvider. The XmlDataProvider references the Orders XML file.

In XAML:

<Grid.Resources>
        <XmlDataProvider Source="../Data/Orders.xml"
          x:Key="OrderData" XPath="/Orders" />
</Grid.Resources>
  1. Create an instance of XamDataGrid, name it, and set its DataSource to the XmlDataProvider created in the previous step.

In XAML:

<igDP:XamDataGrid x:Name="XamDataGrid1"
  DataSource="{Binding Source={StaticResource OrderData}, XPath=Order}"/>
  1. Before running the project, right click ThemePackTestProject and click Set as StartUp Project.

  2. Run the project. When the mouse hovers over Records, they should be highlighted with a gold gradient.

xamdatagrid using custom created themepack