Prerequisite Knowledge Views and Themes: Multi-surface Themes Overview Multi-surface Themes: Surface Configurations |
Surface configurations, which can be applied to any surface exposed by a multi-surface view, support various regions in which data can be displayed. How and where the supported regions are displayed is determined by the multi-surfaces themes.
A multi-surface theme determines how rows (i.e., cards or card surfaces) are laid out by providing a ControlTemplate that targets Row and row-derived objects (e.g., DataRow) and that contains RegionPresenters whose visibility and positions are determined by surface configurations. Each region presenter can be configured through RegionConfiguration properties that are exposed by surface configurations and marked with the TargetRegionPresenterName attribute to identify their corresponding region presenter by their unique, case-sensitive name (see Region Configurations section in Surface Configurations).
The following diagram illustrates the relationships between the ControlTemplate, surface configurations, and region configurations.
Like ContentPresenters, RegionPresenters are included in ControlTemplates to indicate where content (i.e., regions) is to be displayed. As such, through their Content property, the visual tree used to display their data can be provided.
Within a region presenter, a Panel must be identified as the element in which the cells displayed in the region will be contained by setting the presenter's IsCellsHost attached property to true. If a corresponding region configuration defines a new template but does not include a Panel identified as being a cell host, the names of the fields that were provided through the FieldNames property but were not explicitly positioned in the template will not be displayed in the region.
The IsDefaultRegion property identifies 1 region presenter in the ControlTemplate (usually the "data" region presenter) as being the default region in which information from the fields that have not been explicitly assigned to another region (through a region configuration) is displayed. If the IsDefaultRegion property is set on more than one region presenter, the last presenter on which it was set will be used as the default region.
A region presenter's ReadOnly property indicates whether any DataCells that may end up being contained in the region will be editable. By default, image and title region presenters have their ReadOnly property set to true and data region presenters to false. Region presenters also expose the ImageStretchDirection and ImageStretch properties, which determine how images in the region are scaled and stretched, respectively.
All of Xceed's multi-surface themes target the 7 base surface configurations (see Table 1 in Surface Configurations) and identify the region presenters in the ControlTemplate using a standardized naming convention similar to that adopted by the WPF framework for template part names (see Table 1).
All region presenters have an associated RegionConfiguration property that is marked with the TargetRegionPresenterName attribute to identify its corresponding region presenter by its unique, case-sensitive name.
Table 1: Region presenter names
Name | Description |
---|---|
REGION_Image | Identifies the RegionPresenter in the ControlTemplate where image fields can be displayed. |
REGION_Title | Identifies the RegionPresenter in the ControlTemplate where the title fields can be displayed. |
REGION_Data | Identifies the RegionPresenter in the ControlTemplate where the fields that have not be explicitly assigned to another region are displayed. This region presenter is usually identified as the "default" region (see IsDefaultRegion property) |
By default, if a region configuration does not explicitly state the names of the fields to display or does not provide a new template for its corresponding region presenter, an attempt will be made to automatically extract the fields that will be displayed in each region. If an image field exists in the data source, it will automatically be displayed in the image region (REGION_Image). In the case where more than one image is available, the first one that is found will be used. If no image is found and a surface configuration with an image region is used, a blank "place-holder" will be displayed in the image region. Furthermore, the title region (REGION_Title) will automatically display the value of the main column, and the data region (REGION_Data) will display the remaining fields.
Through a multi-surface view's SurfaceConfigurationContext attached property, the properties exposed by a surface configuration and multi-surface theme (e.g., TitleRegionPosition and GradientLightColor) can be accessed in order to bind elements in the theme-defined ControlTemplates to their values or use them in triggers (see CardflowView3D.Elemental.Pink resource dictionary).
Because creating a custom surface configuration and multi-surface theme requires more than a code snippet to demonstrate, links to the required classes are provided below: