# C1.C1Preview.Style.AmbientParent

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_C1Preview_Style_AmbientParent_" data-uid="C1.C1Preview.Style.AmbientParent*">AmbientParent Property
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_C1Preview_Style_AmbientParent_" data-uid="C1.C1Preview.Style.AmbientParent*"></a>
<h4 id="C1_C1Preview_Style_AmbientParent" data-uid="C1.C1Preview.Style.AmbientParent">AmbientParent</h4>
<div class="markdown level1 summary"><p>Gets or sets the <a class="xref" href="C1.C1Preview.Style.html">Style</a> that is the ambient parent of the current style.</p>
<p>
If non-<b>null</b>, that style provides the values for ambient properties
of the current style that have not been explicitly set.
</p>
<p>
If <b>null</b>, such properties are inherited from the style of the containing object.
</p>
<p>
This property is <b>null</b> by default.
</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public Style AmbientParent { get; set; }</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Property AmbientParent As Style</code></pre>
</div>
<h5 id="C1_C1Preview_Style_AmbientParent_remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>Initially a <a class="xref" href="C1.C1Preview.Style.html">Style</a> 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-<b>null</b> value, in which case they are
inherited from that style.</p>
<p>
Note that even if an <b>AmbientParent</b> 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.
</p>
</div>
<h5 id="C1_C1Preview_Style_AmbientParent_examples">Examples</h5>
<p>For instance, the following code:</p>
<pre><code class="lang-csharp">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);</code></pre>
<p>still prints &quot;my text&quot; in bold, while this code:</p>
<pre><code class="lang-csharp">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);</code></pre>
<p>prints &quot;my text&quot; using regular (non-bold) font. This is because
<a class="xref" href="C1.C1Preview.Style.FontBold.html#C1_C1Preview_Style_FontBold">FontBold</a> has been explicitly set to <b>false</b>
on the style assigned to the <b>AmbientParent</b> on the text object.</p>

</div>
