MindFusion.Wpf Pack Programmer's Guide
Using Expressions in XAML

Reporting for WPF expressions can be used not only in label texts but also as any property value using the markup extension ExpressionExtension. Expressions can be particularly useful for WPF elements participating in the data template of a CustomReportItem. For example the following code defines a custom report item, which renders as a WPF Border. The width of the border is 10 times the value of the SomeNumericId identifier.

XAML  Copy Code

<r:CustomReportItem>

  <r:CustomReportItem.Template>
    <DataTemplate>

      <Border
        Width="{r:Expression '[CDbl(SomeNumericId * 10)]'}"
        Height="15"
        Background="Red"
        BorderBrush="Black"
        BorderThickness="1">
        ...
      </Border>

</r:CustomReportItem>

The expressions are evaluated at the time the object is created from the XAML. In contrast to bindings, the expressions are not reevaluated when one of their components changes.