Progress® Telerik® Reporting R3 2017

Understanding Style Selectors

Style Selectors are used to define how a style will be applied globally to items in a report. Each Style Rule that you create (either in code or using the StyleRule Collection Editor) must be created as one of the following four selectors:

  • TypeSelector
  • AttributeSelector
  • StyleSelector
  • DescendantSelector

Understanding Style Selectors

TypeSelector

A TypeSelector applies to all report items of a particular type, for example a Telerik.Reporting.TextBox or a Telerik.Reporting.PageFooterSection.

When a style is defined as a TypeSelector, the formatting for that style is automatically applied to all items on the report that match the type.

AttributeSelector

An AttributeSelector applies to all report items with a particular attribute (such as Color=Red).

Using an AttributeSelector Style Rule, you could specify that any report item on the report that has children (for example. where the value of the HasChildren property is equal to True) should be Bold.

StyleSelector

A StyleSelector applies to all report items with a particular style name. When defining a StyleSelector style, use the Name property to create a name for the style. Each report item has a StyleName property. By setting the value of StyleName to the name of the StyleSelector Style Rule, that report item will display the attributes of the named style.

DescendantSelector

A DescendantSelector applies to all parent/child report item combinations. The actual Style Rule for the child can be specified by any type of Selector.

For example, you can specify that any TextBox that exists inside of a ReportHeaderSection should have a particular style using a TypeSelector within the DescendantSelector.

Alternatively, you can create multiple StyleSelector Style Rules with the same Name and that descend from different report item types, such as DetailSection or GroupSection. Report items with this Name value in their StyleName property will apply the correct style based on where they are placed in the report , even if they are moved.

See Also