# C1.WPF.Binding.C1Binding

## Content

<div class="doc-site-dotnet-api-container">



  <h1 id="C1_WPF_Binding_C1Binding" data-uid="C1.WPF.Binding.C1Binding" class="text-break">C1Binding Class
</h1>
  <div class="markdown level0 summary"><p>A <a class="xref" href="C1.WPF.Binding.html">C1.WPF.Binding</a> that supports formulas.</p>
</div>
  <div class="markdown level0 conceptual"></div>
  <div class="inheritance">
    <h5>Inheritance</h5>
    <div class="level0"><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
    <div class="level1"><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.windows.markup.markupextension">MarkupExtension</a></div>
    <div class="level2"><span class="xref">C1Binding</span></div>
  </div>
  <div class="implements">
    <h5>Implements</h5>
    <div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.windows.data.ivalueconverter">IValueConverter</a></div>
  </div>
  <h6><strong>Namespace</strong>: <a class="xref" href="C1.WPF.Binding.html">C1.WPF.Binding</a></h6>
  <h6><strong>Assembly</strong>: C1.WPF.Binding.4.6.2.dll</h6>
  <h5 id="C1_WPF_Binding_C1Binding_syntax">Syntax</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public class C1Binding : MarkupExtension, IValueConverter</code></pre>
  </div>
  <div class="codewrapper">
    <pre><code class="lang-vbnet hljs">Public Class C1Binding
    Inherits MarkupExtension
    Implements IValueConverter</code></pre>
  </div>
  <h5 id="C1_WPF_Binding_C1Binding_remarks"><strong>Remarks</strong></h5>
  <div class="markdown level0 remarks"><pre><code>&lt;p&gt;The &lt;b&gt;C1Binding&lt;/b&gt; class is similar to a regular &lt;xref href=&quot;C1.WPF.Binding&quot; data-throw-if-not-resolved=&quot;false&quot;&gt;&lt;/xref&gt;,
</code></pre>
<p>but supports expressions instead of simple paths.</p>
<p>The expression syntax is similar to the one used in Excel formulas, including
support for the IF statement which makes it easy to create bindings that make
<b>Converters</b> unnecessary.</p>
</div>
  <h5 id="C1_WPF_Binding_C1Binding_examples"><strong>Examples</strong></h5>
  <p>The XAML below uses the <b>C1Binding</b> class to bind several properties of a
<b>TextBlock</b> element to a data value. Notice that the bindings are used to provide
values for properties of several types, and no converters are required.</p>
<pre><code class="lang-csharp">&lt;TextBlock 
    Text="{c1:C1Binding Expression=CustomerName}" 
    Visibility="{c1:C1Binding Expression='if(Active, |Visible|, |Collapsed|)'}"
    FontWeight="{c1:C1Binding Expression='if(Sales &gt; 200, |Bold|, |Normal|)'}"
    Foreground="{c1:C1Binding Expression='if(Sales &gt; 200, |Blue|, |Red|)'}" /&gt;</code></pre>
<p>Notice how the XAML snippet above specifies the 'Expression' property. This is
required only in Silverlight, and could be omitted in WPF.
Notice also how vertical bars ('|') are used to specify quotes inside expressions.
You could also use &amp;quot; instead, but the bars made the code more readable.</p>

  <h3 id="constructors">Constructors
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="C1_WPF_Binding_C1Binding__ctor" data-uid="C1.WPF.Binding.C1Binding.#ctor">
          <a class="xref" href="C1.WPF.Binding.C1Binding.-ctor.html#C1_WPF_Binding_C1Binding__ctor">C1Binding()</a>
        </td>
        <td class="markdown level1 summary"><p>Initializes a new instance of a <a class="xref" href="C1.WPF.Binding.C1Binding.html">C1Binding</a>.</p>
</td>
      </tr>
      <tr>
        <td id="C1_WPF_Binding_C1Binding__ctor_System_String_" data-uid="C1.WPF.Binding.C1Binding.#ctor(System.String)">
          <a class="xref" href="C1.WPF.Binding.C1Binding.-ctor.html#C1_WPF_Binding_C1Binding__ctor_System_String_">C1Binding(string)</a>
        </td>
        <td class="markdown level1 summary"><p>Initializes a new instance of a <a class="xref" href="C1.WPF.Binding.C1Binding.html">C1Binding</a>.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="properties">Properties
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="C1_WPF_Binding_C1Binding_Expression" data-uid="C1.WPF.Binding.C1Binding.Expression">
          <a class="xref" href="C1.WPF.Binding.C1Binding.Expression.html#C1_WPF_Binding_C1Binding_Expression">Expression</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets the expression used to calculate the binding value.</p>
</td>
      </tr>
      <tr>
        <td id="C1_WPF_Binding_C1Binding_FallbackValue" data-uid="C1.WPF.Binding.C1Binding.FallbackValue">
          <a class="xref" href="C1.WPF.Binding.C1Binding.FallbackValue.html#C1_WPF_Binding_C1Binding_FallbackValue">FallbackValue</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets the value to use when the binding is unable to return a value.</p>
</td>
      </tr>
      <tr>
        <td id="C1_WPF_Binding_C1Binding_StringFormat" data-uid="C1.WPF.Binding.C1Binding.StringFormat">
          <a class="xref" href="C1.WPF.Binding.C1Binding.StringFormat.html#C1_WPF_Binding_C1Binding_StringFormat">StringFormat</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets a string that specifies how to format the binding value.</p>
</td>
      </tr>
      <tr>
        <td id="C1_WPF_Binding_C1Binding_TargetNullValue" data-uid="C1.WPF.Binding.C1Binding.TargetNullValue">
          <a class="xref" href="C1.WPF.Binding.C1Binding.TargetNullValue.html#C1_WPF_Binding_C1Binding_TargetNullValue">TargetNullValue</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets the value that is used in the target when the value of the source is null.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="methods">Methods
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="C1_WPF_Binding_C1Binding_ProvideValue_System_IServiceProvider_" data-uid="C1.WPF.Binding.C1Binding.ProvideValue(System.IServiceProvider)">
          <a class="xref" href="C1.WPF.Binding.C1Binding.ProvideValue.html#C1_WPF_Binding_C1Binding_ProvideValue_System_IServiceProvider_">ProvideValue(IServiceProvider)</a>
        </td>
        <td class="markdown level1 summary"><p>Returns an object that is provided as the value of the target property
for this markup extension.</p>
</td>
      </tr>
    </tbody>
  </table>

</div>
