ComponentOne Binding Expressions for WPF and Silverlight
C1.Silverlight.Binding Namespace / C1Binding Class
Members Example

In This Topic
    C1Binding Class
    In This Topic
    A C1.Silverlight.Binding that supports formulas.
    Object Model
    C1Binding Class
    Syntax
    'Declaration
     
    
    Public Class C1Binding 
       Inherits System.Windows.Markup.MarkupExtension
    public class C1Binding : System.Windows.Markup.MarkupExtension 
    Remarks

    The C1Binding class is similar to a regular C1.Silverlight.Binding, but supports expressions instead of simple paths.

    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 Converters unnecessary.

    Example
    The XAML below uses the C1Binding class to bind several properties of a TextBlock element to a data value. Notice that the bindings are used to provide values for properties of several types, and no converters are required. 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 " instead, but the bars made the code more readable.
    <TextBlock 
        Text="{c1:C1Binding Expression=CustomerName}" 
        Visibility="{c1:C1Binding Expression='if(Active, |Visible|, |Collapsed|)'}"
        FontWeight="{c1:C1Binding Expression='if(Sales > 200, |Bold|, |Normal|)'}"
        Foreground="{c1:C1Binding Expression='if(Sales > 200, |Blue|, |Red|)'}" />
    Inheritance Hierarchy

    System.Object
       System.Windows.Markup.MarkupExtension
          C1.Silverlight.Binding.C1Binding

    See Also