All style properties affecting the appearance of the object to which the style is applied (such as Font, BackColor, and so on) may be in one of two states: set or not set. Initially, all properties of a newly created style are not set. Their values can be queried, but are obtained from another style or object via inheritance (see below). If a property is set though, the set value is stored in the style itself, and is no longer affected by other styles via inheritance.
A style has two special properties to support style inheritance: Parent and AmbientParent. The Parent property gets or sets the style that provides values for non-ambient properties that are not set on the current style. The AmbientParent property gets or sets the style that provides values for ambient properties that are not set on the current style. By default, both parents of a newly created inline style are empty (null values in C#, Nothing in VB), whereas for styles created on the Children collection of a style, the Parent is set to the style containing that collection, while the AmbientParent is empty.
If the Parent of a style is not specified, the values of non-ambient properties are taken from static defaults (see the table below). If the AmbientParent of a style is not specified, the values of ambient properties are taken from the object which contains the object the current style applies to.
For example, if a RenderText rt is contained in a RenderArea ra, then the following rules will be used to retrieve the font (that is, an ambient style property) used to render the text:
In the same example, the following rules will be used to retrieve the BackgroundImage (a non-ambient style property) for the RenderText object:
Please note that although by default styles in the Children collection of a style have their Parent set to the style which is the owner of that Children collection, this can be changed. For example, the parent of one style in the Children collection may be set to another style in the same collection. The Children collection is just a convenient place to group/store related styles, but does not really impose any limitations on the styles hierarchy.