ComponentOne Reports for WinForms Designer Edition: ComponentOne Reports for WinForms > Working with C1PrintDocument > Styles > Ambient and Non-Ambient Style Properties

Ambient and Non-Ambient Style Properties

All style properties (font, colors, borders, and so on) can be classified into two groups according to their semantics: ambient and non-ambient. Ambient properties are those that affect the content of an object (for example, the text font) whereas non-ambient properties are those used to paint the object's adornments, or decorations (for example, the borders around the object). This distinction is natural and useful, as in most cases the desired behaviors (especially the inheritance rules) are different for the two groups.

For ambient properties, it is usually desirable to propagate them down the hierarchy of objects, so that setting of an ambient property on a container object affects all objects contained within (consider a table – if you set the font on the table itself, you would normally want that font to be applied to texts in all cells of that table, unless explicitly overridden at a lower level – for example, for a specific cell). This is markedly different for non-ambient properties. For instance, if you wanted to add white space before and after that table, you would set the Spacing property on that table – but you would not want that spacing to propagate to all cells. In C1PrintDocument, this division of style properties into ambient and non-ambient groups is built in. Basically, this means that usually just setting the property on the style of an object (without thinking too much about ambience) will do what you expect.

The complete list of all style properties, indicating which of those properties are ambient and which are not, is shown in a separate section below (see Style Properties and Their Default Values). But the following general rule applies:

Ambient style properties control the display of the object's content (such as text font). By default, ambient properties propagate down the objects' containment hierarchy – i.e. an ambient property set on the style of a container object is applied to all objects within that container.

Non-ambient style properties control the object's decorations (such as borders). By default, non-ambient properties do not propagate via objects' containment, but can propagate across styles via the Style.Parent property.


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.