ExpressionPropertyEditor. Parameters

Parameters are named values that are specified in the application and available for use in expressions. Parameters are created in the application code. Values of the parameters can change at different times in the course of execution of the application.

expressionpropertyeditor_7

Parameters are stored in the ParametersDictionary collection. The expression editor ExpressionPropertyEditor exposes two events for access to parameters:

  • CollectParameters: it collects parameter names and descriptions.
  • CollectParametersValues: it supplies values for the parameter names in the course of debugging the formula.

Below is the code snippet demonstrating the use of the parameter collection in the controller.

You can see the code discussed in this topic in the ExpressionEditorParametersViewController.cs file the Feature Center demo installed with Xafari.

Note:

It is necessary to use the GetValue method of the static ExpressionCalculator class in order to calculate the value of the expression.

The GetValue method has optional parameter Parameters:

  • ExpressionCalculator.GetValue(string expression, object context, Dictionary<string, object> parameters = null)
  • ExpressionCalculator.GetValue(string expression, Dictionary<string, object> parameters = null)

Use Parameters for passing the values of the parameters.