EditContext Class

Definition

Holds metadata related to a data editing process, such as flags to indicate which fields have been modified and the current set of validation messages.

public ref class EditContext sealed
public sealed class EditContext
type EditContext = class
Public NotInheritable Class EditContext
Inheritance
EditContext

Constructors

EditContext(Object)

Constructs an instance of EditContext.

Properties

Model

Gets the model object for this EditContext.

Properties

Gets a collection of arbitrary properties associated with this instance.

Methods

Field(String)

Supplies a FieldIdentifier corresponding to a specified field name on this EditContext's Model.

GetValidationMessages()

Gets the current validation messages across all fields.

This method does not perform validation itself. It only returns messages determined by previous validation actions.

GetValidationMessages(Expression<Func<Object>>)

Gets the current validation messages for the specified field.

This method does not perform validation itself. It only returns messages determined by previous validation actions.

GetValidationMessages(FieldIdentifier)

Gets the current validation messages for the specified field.

This method does not perform validation itself. It only returns messages determined by previous validation actions.

IsModified()

Determines whether any of the fields in this EditContext have been modified.

IsModified(Expression<Func<Object>>)

Determines whether the specified fields in this EditContext has been modified.

IsModified(FieldIdentifier)

Determines whether the specified fields in this EditContext has been modified.

MarkAsUnmodified()

Clears all modification flags within this EditContext.

MarkAsUnmodified(FieldIdentifier)

Clears any modification flag that may be tracked for the specified field.

NotifyFieldChanged(FieldIdentifier)

Signals that the value for the specified field has changed.

NotifyValidationStateChanged()

Signals that some aspect of validation state has changed.

Validate()

Validates this EditContext.

Events

OnFieldChanged

An event that is raised when a field value changes.

OnValidationRequested

An event that is raised when validation is requested.

OnValidationStateChanged

An event that is raised when validation state has changed.

Extension Methods

AddDataAnnotationsValidation(EditContext)
Obsolete.

Adds DataAnnotations validation support to the EditContext.

EnableDataAnnotationsValidation(EditContext)
Obsolete.

Enables DataAnnotations validation support for the EditContext.

EnableDataAnnotationsValidation(EditContext, IServiceProvider)

Enables DataAnnotations validation support for the EditContext.

FieldCssClass(EditContext, FieldIdentifier)

Gets a string that indicates the status of the specified field as a CSS class.

FieldCssClass<TField>(EditContext, Expression<Func<TField>>)

Gets a string that indicates the status of the specified field as a CSS class. This will include some combination of "modified", "valid", or "invalid", depending on the status of the field.

SetFieldCssClassProvider(EditContext, FieldCssClassProvider)

Associates the supplied FieldCssClassProvider with the supplied EditContext. This customizes the field CSS class names used within the EditContext.

Applies to