Gets or sets the Style that is the ambient parent of the current style.
Namespace:
C1.C1PreviewIf non-null, that style provides the values for ambient properties of the current style that have not been explicitly set.
If null, such properties are inherited from the style of the containing object.
This property is null by default.
Assembly: C1.C1Report.2 (in C1.C1Report.2.dll)
Syntax
Remarks
Initially a Style object does not have any
explicitly set properties. This means that the effective
values of all ambient properties (such as font) are inherited from
the style of the containing object, unless this property has
been set to a non-null value, in which case they are
inherited from that style.
Note that even if an AmbientParent has been specified, only ambient properties that have been explicitly set on that style or any of its own ambient parents (styles or containing objects) propagate to the current style. See example below for details.
Examples
For instance, the following code:
still prints "my text" in bold, while this code:
prints "my text" using regular (non-bold) font. This is because
FontBold has been explicitly set to false
on the style assigned to the AmbientParent on the text object.
Copy CodeC#
C1PrintDocument doc = new C1PrintDocument(); RenderArea ra = new RenderArea(); ra.Style.FontBold = true; RenderText rt = new RenderText("my text"); ra.Style.AmbientParent = doc.Style; ra.Children.Add(rt); doc.Body.Children.Add(ra); |
Copy CodeC#
C1PrintDocument doc = new C1PrintDocument(); doc.Style.FontBold = false; // this line makes the difference! RenderArea ra = new RenderArea(); ra.Style.FontBold = true; RenderText rt = new RenderText("my text"); ra.Style.AmbientParent = doc.Style; ra.Children.Add(rt); doc.Body.Children.Add(ra); |