... xmlns:igDP="http://infragistics.com/DataPresenter" xmlns:igThemeOrangePeel="http://infragistics.com/Themes/OrangePeel" ...
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™.
In the Solution Explorer, right click the solution and click Add, then click New Project… Name the project "ThemePackTestProject."
Add a New Folder to the project called "Data" and place the Orders.xml file inside it.
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.
Add a reference to the assembly that the MyThemePack project generated.
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" ...
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>
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>
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}"/>
Before running the project, right click ThemePackTestProject and click Set as StartUp Project.
Run the project. When the mouse hovers over Records, they should be highlighted with a gold gradient.