See Also: ExpressionEditorSheet Members
A custom expression editor sheet lets a developer set properties on a custom expression at design-time. Control property values can be set using expression strings; the expression strings are evaluated at run time by an expression builder and at design time by an expression editor.
When you browse the HtmlControlDesigner.Expressions property for a control in the design-time properties grid, the visual designer displays a dialog box to set expressions that provide the value for a control property. You can select the expression type based on a list of expression prefixes. When you select an expression prefix from the list, the visual designer uses the associated System.Web.UI.Design.ExpressionEditor and System.Web.UI.Design.ExpressionEditorSheet objects to evaluate and convert the expression string based on the syntax for that type of expression. The visual designer uses expression editor sheet properties to prompt for one or more strings that combine into the custom expression string.
Typically, to supply a new expression type at design time, you define a unique expression prefix and provide custom System.Web.Compilation.ExpressionBuilder and System.Web.UI.Design.ExpressionEditor implementations. Optionally, you can provide a custom System.Web.UI.Design.ExpressionEditorSheet implementation that defines properties that are used to form the expression. To associate an expression prefix with an expression builder and an expression editor, apply the System.Web.Compilation.ExpressionEditorAttribute attribute and an System.Web.Compilation.ExpressionPrefixAttribute attribute to the custom System.Web.Configuration.ExpressionBuilder class, and then configure the expression prefix for an expression builder in the expressionBuilders element in the Web configuration file.
The default implementation of the ExpressionEditor.GetExpressionEditorSheet(string, IServiceProvider) method returns a basic editor sheet, which uses a single input string to form the expression. Custom expression editors that are derived from the System.Web.UI.Design.ExpressionEditor can override the ExpressionEditor.GetExpressionEditorSheet(string, IServiceProvider) method to return a custom editor sheet implementation. Typically, a custom editor sheet contains multiple properties that are used to build the expression string. The ExpressionEditorSheet.GetExpression method returns the resulting expression string based on the current expression properties.
For example, the System.Web.UI.Design.ResourceExpressionEditor class derives from the System.Web.UI.Design.ExpressionEditor class and provides an implementation for evaluating and associating a resource string reference with a control property at design time. The System.Web.Compilation.ResourceExpressionBuilder class is associated with the expression prefix Resources and the System.Web.UI.Design.ResourceExpressionEditor implementation. The ResourceExpressionEditor.GetExpressionEditorSheet(string, IServiceProvider) method returns a System.Web.UI.Design.ResourceExpressionEditorSheet, which defines the individual properties that form a resource reference expression.
When you inherit from the System.Web.UI.Design.ExpressionEditorSheet class, you must override the following members:
The ExpressionEditor.GetExpressionEditorSheet(string, IServiceProvider) method to return a custom editor sheet implementation.
The ExpressionEditorSheet.#ctor(IServiceProvider) constructor to implement custom initialization actions for your expression editor sheet implementation.