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.

当您在 " Expressions设计时属性" 网格中浏览控件的属性时, 可视化设计器会显示一个对话框, 用于设置为控件属性提供值的表达式。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. 从列表中选择表达式前缀时, 可视化设计器会使用关联ExpressionEditor的和ExpressionEditorSheet对象根据该类型的表达式的语法来计算和转换表达式字符串。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.

通常, 若要在设计时提供新的表达式类型, 请定义唯一的表达式前缀, 并ExpressionBuilder提供ExpressionEditor自定义和实现。Typically, to supply a new expression type at design time, you define a unique expression prefix and provide custom ExpressionBuilder and ExpressionEditor implementations. 还可以提供自定义ExpressionEditorSheet实现, 该实现定义用于构成表达式的属性。Optionally, you can provide a custom ExpressionEditorSheet implementation that defines properties that are used to form the expression. 若要将表达式前缀与表达式生成器和表达式编辑器相关联, 请将ExpressionEditorAttribute属性ExpressionPrefixAttribute和属性应用于自定义ExpressionBuilder类, 然后在Web expressionBuilders配置文件中的元素。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.

GetExpressionEditorSheet方法的默认实现将返回一个基本编辑器表, 该工作表使用单个输入字符串来构成表达式。The default implementation of the GetExpressionEditorSheet method returns a basic editor sheet, which uses a single input string to form the expression. 派生自的ExpressionEditor自定义表达式编辑器可以GetExpressionEditorSheet重写方法以返回自定义编辑器表实现。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. GetExpression方法根据当前的表达式属性返回生成的表达式字符串。The GetExpression method returns the resulting expression string based on the current expression properties.

例如, ResourceExpressionEditor类派生ExpressionEditor自类, 并提供用于在设计时计算资源字符串引用并将资源字符串引用与控件属性关联的实现。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. 类与表达式前缀ResourcesResourceExpressionEditor实现相关联。 ResourceExpressionBuilderThe ResourceExpressionBuilder class is associated with the expression prefix Resources and the ResourceExpressionEditor implementation. GetExpressionEditorSheet 方法ResourceExpressionEditorSheet返回, 它定义构成资源引用表达式的各个属性。The GetExpressionEditorSheet method returns a ResourceExpressionEditorSheet, which defines the individual properties that form a resource reference expression.

ExpressionEditorSheet类继承时, 必须重写以下成员:When you inherit from the ExpressionEditorSheet class, you must override the following members:

Notes to Implementers

如果要为控件属性值定义新ExpressionEditorSheet的表达式类型, 并且想要基于多个表达式属性值生成表达式字符串, 请从类派生自定义表达式编辑器表。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.

-从编辑器表属性GetExpression()值组成自定义表达式字符串的方法的实现。- 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.

关联的自定义表达式编辑器类在GetExpressionEditorSheet(String, IServiceProvider)方法中创建一个派生编辑器表的实例, 使用该控件属性的当前表达式字符串来初始化该实例, 并将该实例返回到可视化设计器。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. 可视化设计器允许您设置表达式表属性, 然后调用GetExpression()方法, 以从输入表达式表属性值中形成表达式字符串。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)

初始化 ExpressionEditorSheet 类的新实例。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()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

创建当前 Object 的浅表副本。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