Επεξεργασία

Κοινή χρήση μέσω


ExpressionEditorSheet Class

Definition

Represents a design-time editor sheet for a custom expression. This class must be inherited.

public ref class ExpressionEditorSheet abstract
public abstract class ExpressionEditorSheet
type ExpressionEditorSheet = class
Public MustInherit Class ExpressionEditorSheet
Inheritance
ExpressionEditorSheet
Derived

Remarks

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 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 ExpressionEditor and 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 ExpressionBuilder and ExpressionEditor implementations. Optionally, you can provide a custom 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 ExpressionEditorAttribute attribute and an ExpressionPrefixAttribute attribute to the custom 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 GetExpressionEditorSheet method returns a basic editor sheet, which uses a single input string to form the expression. Custom expression editors that are derived from the ExpressionEditor can override the GetExpressionEditorSheet 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 GetExpression method returns the resulting expression string based on the current expression properties.

For example, the ResourceExpressionEditor class derives from the ExpressionEditor class and provides an implementation for evaluating and associating a resource string reference with a control property at design time. The ResourceExpressionBuilder class is associated with the expression prefix Resources and the ResourceExpressionEditor implementation. The GetExpressionEditorSheet method returns a ResourceExpressionEditorSheet, which defines the individual properties that form a resource reference expression.

When you inherit from the ExpressionEditorSheet class, you must override the following members:

Notes to Implementers

Derive a custom expression editor sheet from the ExpressionEditorSheet class, if you are defining a new expression type for control property values and you want to build the expression string based on multiple expression property values. A derived class implementation should contain the following:

  • A public property for each distinct value in the expression string that can be set at design time.

  • An implementation of the GetExpression() method that forms the custom expression string from the editor sheet property values.

  • Optionally, a constructor implementation that sets the initial values of the editor sheet properties.

The associated custom expression editor class creates an instance of the derived editor sheet in the GetExpressionEditorSheet(String, IServiceProvider) method, initializes that instance with the current expression string set for the control property, and returns the instance to the visual designer. The visual designer allows you to set the expression sheet properties, and then calls the GetExpression() method to form the expression string from the input expression sheet property values.

Constructors

ExpressionEditorSheet(IServiceProvider)

Initializes a new instance of the ExpressionEditorSheet class.

Properties

IsValid

Gets a value that indicates whether the expression string is valid.

ServiceProvider

Gets the service provider implementation that is used by the expression editor sheet.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetExpression()

When overridden in a derived class, returns the expression string that is formed by the expression editor sheet property values.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

See also