Overriding Theme Attributes in the Project
As an alternative to creating or editing a theme file, you can override necessary attributes within the project file itself. This is a better choice when you are only changing a few attributes and do not want to create a new theme file. When overriding existing attributes you would create a resource dictionary based on the theme you wish to edit and set any attributes in that dictionary. For information about the values that can be customized, see the Resource Keys topic.
For example, add the following XAML just after the <Window> tag to create a theme ResourceDictionary based on Office2007Silver theme and override the C1DataGrid_GridLineVertical_Thickness and C1DataGrid_GridLineHorizontal_Thickness values:
<Window.Resources>
<ResourceDictionary x:Key="overrideTheme">
<ResourceDictionary.MergedDictionaries>
<!—Base the resource on the Office2007Silver theme. -->
<StaticResourceExtension ResourceKey="{c1grid:C1ThemeKey TypeInTargetAssembly={x:Type c1grid:C1DataGrid}, ThemeName=Office2007Silver}"/>
</ResourceDictionary.MergedDictionaries>
<!-- Override the C1DataGrid_GridLineVertical_Thickness and C1DataGrid_GridLineHorizontal_Thickness values. -->
<sys:Double x:Key="C1DataGrid_GridLineVertical_Thickness">0</sys:Double>
<sys:Double x:Key="C1DataGrid_GridLineHorizontal_Thickness">0</sys:Double>
</ResourceDictionary>
</Window.Resource>
This resource dictionary merges a theme dictionary directly from within the grid assembly (by means of the StaticResource extension) and directly adds two items to override values from the original dictionary. These two values set the grid to that vertical and horizontal grid lines are not visible.
Assign this dictionary to the Theme property:
<!-- Add XAML to set the Theme property in the C1DataGrid tag --->
<c1grid:C1DataGrid Name="C1DataGrid1" Theme="{DynamicResource overrideTheme}">
|