Επεξεργασία

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


ExpressionEditor.GetExpressionEditorSheet(String, IServiceProvider) Method

Definition

Returns an expression editor sheet that is associated with the current expression editor.

public:
 virtual System::Web::UI::Design::ExpressionEditorSheet ^ GetExpressionEditorSheet(System::String ^ expression, IServiceProvider ^ serviceProvider);
public virtual System.Web.UI.Design.ExpressionEditorSheet GetExpressionEditorSheet (string expression, IServiceProvider serviceProvider);
abstract member GetExpressionEditorSheet : string * IServiceProvider -> System.Web.UI.Design.ExpressionEditorSheet
override this.GetExpressionEditorSheet : string * IServiceProvider -> System.Web.UI.Design.ExpressionEditorSheet
Public Overridable Function GetExpressionEditorSheet (expression As String, serviceProvider As IServiceProvider) As ExpressionEditorSheet

Parameters

expression
String

The expression string set for a control property, used to initialize the expression editor sheet.

serviceProvider
IServiceProvider

A service provider implementation supplied by the designer host, used to obtain additional design-time services.

Returns

An ExpressionEditorSheet that defines the custom expression properties.

Remarks

The GetExpressionEditorSheet method returns an ExpressionEditorSheet implementation that defines the strings that are combined to form a custom expression. The visual designer uses an expression editor sheet to prompt for one or more strings that combine into a custom expression. The base class method returns a default expression editor sheet, which uses a single input string to form the expression. The expression editor sheet defines the property grid for the expression. Therefore, the properties that the expression editor exposes become properties that can be defined for the expression in the dialog box.

Classes deriving from the ExpressionEditor class optionally can override the GetExpressionEditorSheet method to provide a custom expression editor sheet. A custom expression editor sheet can allow design-time input for multiple properties, which are combined together to form the expression string.

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 ResourceExpressionEditor.GetExpressionEditorSheet method returns a ResourceExpressionEditorSheet, which defines the individual properties that form a resource reference expression.

Notes to Inheritors

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. Even though the configuration file defines the prefix, you should also apply an ExpressionPrefixAttribute object and an ExpressionEditorAttribute object.

Override the GetExpressionEditorSheet(String, IServiceProvider) method to return an expression editor sheet that defines design-time input for multiple properties in a custom expression. When you select a control property and the expression editor type, the visual designer calls the GetExpressionEditorSheet(String, IServiceProvider) method, and then supplies the current expression string that is set for the control property. Use expression to set the initial values for the expression properties. Use serviceProvider to initialize a custom expression sheet constructor and to access services that are provided by the designer host. For example, call the GetService(Type) method with the IWebApplication type to access project items, documents, or configuration file details that are provided through the visual designer.

Applies to

See also