Skip to main content

Chameleon Theme

The Chameleon multi-surface theme, which is represented by the ChameleonTheme class, is a two-tone theme that provides full control over its gradient color scheme.

Chameleon

Figure 1: Chameleon theme with default surface configurations and color scheme

The Chameleon theme is contained in the "Views 3D" assembly (Xceed.Wpf.DataGrid.Views3D.dll), and like other themes, it can be set using either attribute syntax or property element syntax through a multi-surface view's Theme property (see Example 1).

ThemeColor schemeAttribute syntaxProperty element syntaxAssembly
Chameleon[View.]Chameleon [View.]ChameleonThemeChameleonThemeCardflowView3DXceed.Wpf.DataGrid.Views3D

Gradient Color Scheme

Unique to the Chameleon multi-surface theme is the ability to control the colors that are used to create its gradient. Through the GradientLightColor and GradientDarkColor properties, the colors that will be blended from top to bottom, respectively, can be provided (see Example 2).

Default Surface Configurations

Like all multi-surface themes, the Chameleon theme provides the default SurfaceConfigurations that will be applied to a multi-surface view's surfaces (see Table 1 for a list of the default surface configurations). These default configurations can be overridden by adding surface configurations to a theme's SurfaceConfigurations collection and specifying the surfaces to which they will be applied using the Surfaces attached property defined on the multi-surface view (see Examples 1 and 3 in Surface Configurations). If a surface configuration is added to the SurfaceConfigurations collection but does not specify the surfaces to which it should be applied, it will be ignored. If more than one configuration specifies the same surface, the last one on which the Surfaces attached property was set will be used.

Table 1: Default Chameleon surface configurations

Multi-surface viewSurfaceDefault surface configurationIndex
CardflowView3DLeftImageAndTitleSurfaceConfiguration0
CardflowView3DRightImageAndTitleSurfaceConfiguration1
CardflowView3DCenterCompleteSurfaceConfiguration2
CardflowView3DBackDataSurfaceConfiguration3

Title-region Positions

For some surface configurations, the Chameleon theme supports more than one title-region position (see Table 2). As such, it exposes a TitleRegionPosition attached property that can be set on any of the supported surface configurations to change the position of the title region. The TitleRegionPosition property can also be set directly on the theme to change the title-region position of all the supported surface configurations.

Table 2: Possible title-region positions

Surface configurationPositions
TitleSurfaceConfigurationLeft and Right
ImageAndTitleSurfaceConfigurationLeft and Right
CompleteSurfaceConfigurationLeft and Right
TitleAndDataSurfaceConfigurationLeft and Right

Examples

All examples in this topic assume that the grid is bound to the Employees table of the Northwind database, unless stated otherwise.

Example 1: Using the Chameleon theme

The following example demonstrates how to set a multi-surface theme using property element syntax.

  <Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid">
<Grid.Resources>
<xcdg:DataGridCollectionViewSource x:Key="cvs_employees"
Source="{Binding Source={x:Static Application.Current}, Path=EmployeesTable}"/>
</Grid.Resources>
<xcdg:DataGridControl x:Name="EmployeesGrid"
ItemsSource="{Binding Source={StaticResource cvs_employees}}">
<xcdg:DataGridControl.View>
<xcdg:CardflowView3D>
<xcdg:CardflowView3D.Theme>
<xcdg:ChameleonTheme/>
</xcdg:CardflowView3D.Theme>
</xcdg:CardflowView3D>
</xcdg:DataGridControl.View>
</xcdg:DataGridControl>
</Grid>
Example 2: Providing new gradient colors

The following example demonstrates how to change the gradient applied to the card surfaces when using the Chameleon theme.

GradientColors

  <Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid">
<Grid.Resources>
<xcdg:DataGridCollectionViewSource x:Key="cvs_employees"
Source="{Binding Source={x:Static Application.Current}, Path=EmployeesTable}"/>
</Grid.Resources>
<xcdg:DataGridControl x:Name="EmployeesGrid"
ItemsSource="{Binding Source={StaticResource cvs_employees}}">
<xcdg:DataGridControl.Columns>
<xcdg:Column FieldName="LastName" IsMainColumn="True"/>
<xcdg:Column FieldName="Notes" Visible="False"/>
<xcdg:Column FieldName="ReportsTo" Visible="False"/>
<xcdg:Column FieldName="StillEmployed" Visible="False"/>
<xcdg:Column FieldName="TitleOfCourtesy" Visible="False"/>
</xcdg:DataGridControl.Columns>
<xcdg:DataGridControl.View>
<xcdg:CardflowView3D>
<xcdg:CardflowView3D.Theme>
<xcdg:ChameleonTheme GradientLightColor="Pink"
GradientDarkColor="Purple">

</xcdg:ChameleonTheme>
</xcdg:CardflowView3D.Theme>
</xcdg:CardflowView3D>
</xcdg:DataGridControl.View>
</xcdg:DataGridControl>
</Grid>