Adding a Theme File to the Project
Themes are located in the Studio for WPF installation directory, by default in the C1WPFDataGrid\XAML folder. You can choose to incorporate a customized version of one of these themes into your project with a few simple steps. Note that in this example the Office2007Default.xaml file is used.
1. Copy the existing theme file (such as Office2007Default.xaml) to the project folder and rename it (for example to MyTheme.xaml).
2. In Blend, select Project | Add Existing Item to add the XAML file.
3. In the Add Existing Item dialog box, select the XAML file you copied to your project folder and select OK.
The file will be added to your project.
4. Add the XAML file to your resource dictionary by adding the following XAML just after the <Window> tag:
<Window.Resources>
<ResourceDictionary>
<!--Replace gridtheme below with a name you choose -->
<ResourceDictionary x:Key="gridtheme">
<ResourceDictionary.MergedDictionaries>
<!--Replace MyTheme.xaml below with the file name you chose -->
<ResourceDictionary Source="MyTheme.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</ResourceDictionary>
</Window.Resources>
5. Set the C1DataGrid's theme property to the custom theme you just added, for example with the following XAML:
<!-- Add XAML to set the Theme property in the C1DataGrid tag --->
<c1grid:C1DataGrid Name="C1DataGrid1" Theme="{DynamicResource gridtheme}">
6. Double-click the MyTheme.xaml file, or the file name you choose, in the Project pane in Blend and edit existing values you wish to customize.
For information about the values that can be customized, see the Resource Keys topic.
|