Close
Just a few details and you gain access to free downloads, support, subscription updates, betas, and special offers.
Join Now





Help Show Password

Read our Privacy Policy

Never write another converter again with ComponentOne Binding Expressions™ for WPF. Save time and write cleaner XAML by taking advantage of C1Binding’s rich, inline expression syntax. Concatenate strings, compute formulas, and even apply if/else logic directly in your binding statements without the need for code-behind converters.

Features

  • Logical and Arithmetic Operators

    Perform simple arithmetic and mathematical functions in your bindings. You can use any of the common logical operators (=, >, <, <>, >=, <=), arithmetic (+, -, *, /, ^), and you can group expressions using parentheses. For example, “Amount * 8.5%” returns the value of the Amount property times 0.085:

    <TextBlock Text="{c1:C1Binding Expression='Amount * 8.5%'}" />

  • Excel Functions

    Binding Expressions support a subset of the functions available in Microsoft Excel. Your C1Binding Expressions may include logical functions (IF, AND, OR), mathematical functions (ABS, FLOOR, LOG, SUM), statistical functions (AVERAGE, COUNT, MAX), and text functions (CONCATENATE, TRIM, UPPER). The complete list of supported functions can be found in the documentation.

  • Formatting Values

    C1Binding objects have a StringFormat property that you can use to control the format of bound values. For example, the following applies a currency format to the evaluated expression:

    <TextBlock Text="{c1:C1Binding Expression='Amount * 8.5%', StringFormat='c'}" />

  • Conditional Formatting

    Suppose you want to apply conditional formatting to your bound values. You can accomplish this using the IF function, which performs conditional logic. For example, the following XAML snippet formats values greater than 1,000 to appear bold:

    <TextBlock
      Text="{c1:C1Binding Amount}"
      FontWeight="{c1:C1Binding Expression='IF(Amount &gt; 1000, |bold|, |normal|)' }" />

  • Combining Values

    You can use text functions to accomplish common scenarios, such as replacing characters, converting to upper or lower case, and combining multiple values into one. For example, you can use the CONCATENATE function to display the total amount in addition to the taxed amount with the following:

    <TextBlock
      Text="{c1:C1Binding Expression=
       
    'CONCATENATE(Amount, &quot; Tax: &quot;, Amount * 8.5%' }" />

  • Use Quotes without Breaking Your XAML

    Use quotes in your binding expressions without breaking your XAML. C1Binding expressions support inline quotes in two forms: & quot; or use of the pipe (|) character. For example, the XAML snippet above could be rewritten with the following for more readability:

    <TextBlock
      Text="{c1:C1Binding Expression=
       
    'CONCATENATE(Amount, | Tax: |, Amount * 8.5%' }" />

  • Clean and Expressive XAML

    By using C1Binding Expressions, your XAML will be much cleaner and more expressive. And it’s 100% self-contained. You do not need any external converters referenced from elsewhere in your solution.

  • Parse and Evaluate Expressions

    C1Binding objects use the C1CalcEngine class to parse and evaluate expressions. It is a public class and can be used independently to parse strings into Expression objects or parse strings to evaluate resulting expressions. For example, you could have a calculated TextBox that allows users to type expressions (ie, 4 + 16), and have them evaluated when the control loses focus by using the C1CalcEngine’s Evaluate method.