ExpressionEditor.EvaluateExpression Method
Assembly: System.Design (in system.design.dll)
public: virtual Object^ EvaluateExpression ( String^ expression, Object^ parseTimeData, Type^ propertyType, IServiceProvider^ serviceProvider ) abstract
public abstract Object EvaluateExpression ( String expression, Object parseTimeData, Type propertyType, IServiceProvider serviceProvider )
public abstract function EvaluateExpression ( expression : String, parseTimeData : Object, propertyType : Type, serviceProvider : IServiceProvider ) : Object
Parameters
- expression
An expression string to evaluate. The expression does not include the expression prefix.
- parseTimeData
An object containing additional parsing information for evaluating expression. This typically is provided by the expression builder.
- propertyType
The type of the control property to which expression is bound.
- serviceProvider
A service provider implementation supplied by the designer host, used to obtain additional design-time services.
Return Value
The object referenced by the evaluated expression string, if the expression evaluation succeeded; otherwise, a null reference (Nothing in Visual Basic).The visual designer host uses the EvaluateExpression method to evaluate an expression and provide the design-time value for an associated control property.
The visual designer uses the ExpressionBuilder.ParseExpression method to parse the expression string at design time, and then calls the EvaluateExpression method with the parsed expression data. The visual designer uses the evaluated expression result to assign control property values that are rendered on the design surface.
Notes to Inheritors Classes deriving from the ExpressionEditor class must override the EvaluateExpression method to evaluate the custom expression type at design time. At a minimum, an EvaluateExpression implementation must use the following steps:-
Evaluate the expression string and determine the object that is referenced by the expression.
-
Return a null reference (Nothing in Visual Basic), if the expression string cannot be evaluated.
-
Use the IsAssignableFrom method on propertyType to determine whether the referenced object can be assigned directly to the control property type, and then, depending on the result, complete one of the following actions:
-
If the referenced object can be assigned directly to the control property, return the referenced object for the expression.
-
If the referenced object is a simple type, such as a string, return the referenced object.
-
Otherwise, determine whether the referenced object can be assigned to or converted to the property type.
-
-
Use the CanConvertFrom method on the TypeConverter object for propertyType to determine whether the referenced object can be converted to the control property type, and then, depending on the result, complete one of the following actions:
-
If the object can be converted to the control property type, return the converted object using the ConvertFrom method.
-
If the referenced object cannot be assigned or converted to propertyType, return the referenced object.
-
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.