共用方式為


DomainPropertyValueHandler<TElement,TValue>.OnValueChanging Method

Definition

Called when property value is about to change.

protected:
 virtual void OnValueChanging(TElement element, TValue oldValue, TValue newValue);
protected virtual void OnValueChanging (TElement element, TValue oldValue, TValue newValue);
abstract member OnValueChanging : 'Element * 'Value * 'Value -> unit
override this.OnValueChanging : 'Element * 'Value * 'Value -> unit
Protected Overridable Sub OnValueChanging (element As TElement, oldValue As TValue, newValue As TValue)

Parameters

element
TElement

Element which owns the property.

oldValue
TValue

Old value of the property.

newValue
TValue

New value of the property.

Examples

protected override void OnValueChanging(ElementClassType element, FieldType oldValue, FieldType newValue) { // call the base class implementation first base.OnValueChanging(element, oldValue, newValue); if (element.Store.InUndoRedoOrRollback) { // your undo/redo only code goes here // you cannot make model changes here. // You can only change out-of-model state } else { // your non-undo/redo only code goes here // All your model changes should be done here. // You should not make any out-of-model state changes // here because it will not be in sync after undo/redo } // your other code goes here // you cannot make model changes here. You can only change // out-of-model state. }

Applies to