In order to be able to take advantage of the features exposed by the xamFormulaEditor and FormulaEditorDialog controls you first need to add a xamCalculationManager control to your application as shown in Listing 1. For more information on how to use the xamCalculationManager control, refer to the Using xamCalculationManager section.
Configuring the xamFormulaEditor
-
Adding a xamFormulaEditor to your application.
In order to do this you first need to add references to the following assemblies:
-
InfragisticsWPF.dll
-
InfragisticsWPF.Controls.Interactions.XamFormulaEditor.dll
-
InfragisticsWPF.Controls.Interactions.XamDialogWindow.dll
-
InfragisticsWPF.Controls.Menus.XamDataTree.dll
The last two are required by the FormulaEditorDialog control. Next, you need to add the necessary using/Imports directives in your code-behind or the Infragistics xml namespace for XAML as shown in Listing 1 and to add the xamFormulaEditor itself.
-
Configuring the xamFormulaEditor
To make the xamFormulaEditor control fully functional, you need to set its Target property. The target of a xamFormulaEditor control can be any other control on the same page that is registered in a xamCalculationManager control and that has an appropriate property whose value can be a formula string. For more information about how to use the xamCalculationManager with UI controls, refer to the Getting Started with xamCalculationManager topic.
If the target control has a ControlCalculationSettings object set for the XamCalculationManager.ControlSettings attached property and if the Formula property of the ControlCalculationSettings object is set to a formula string, this formula is automatically loaded in the xamFormulaEditor. If this is not the case you can set the Formula property directly to the xamFormulaEditor. In Listing 2 is an example of how to configure the xamFormulaEditor control.
Note: If you set the Formula property, but not the Target, the xamFormulaEditor will not be active.