UndoRedoHelper
Creates undoable diagram-item property changes and provides reflection-based property assignment helpers.
Definition
Namespace:Telerik.WinControls.UI.Diagrams
Assembly:Telerik.WinControls.RadDiagram.dll
Syntax:
public class UndoRedoHelper
Inheritance: objectUndoRedoHelper
Constructors
public UndoRedoHelper()
Methods
Converts values for int, double, bool, decimal, and string targets; other target types receive the original value.
public static object ConvertValue(Type targetType, object value)
The type requested by the destination property.
valueobjectThe value to convert. A null value for a double target becomes NaN.
Returns:The converted value for a supported target type, or the original value for other types.
Sets a property resolved from an object by a dot-separated property path.
public static bool SetProperty(string propertyName, object source, object value)
The property path to resolve, starting at source.
The object from which to resolve the first property.
valueobjectThe value to convert and assign to the final property.
Returns:true if conversion and assignment complete; false if conversion or the setter throws.
Exceptions: ArgumentNullExceptionsource is null.
The resolved property is read-only.
NullReferenceExceptionA property in the path cannot be resolved or an intermediate property value is null.
Creates and executes an undo command that assigns a new value to a diagram item's property.
public static bool ValueChanged(IDiagramItem diagramItem, string propertyName, object newValue, object oldValue)
A diagram item backed by a RadElement and owned by a RadDiagramElement.
propertyNamestringThe property path assigned by the command.
newValueobjectThe value assigned when the command executes or is redone.
oldValueobjectThe value restored when the command is undone.
Returns:true when command submission completes; this does not report whether the property assignment succeeded.
Exceptions: InvalidCastExceptiondiagramItem is not a RadElement.
diagramItem has no owning RadDiagramElement.
The current implementation compares
oldValueandnewValueby reference, so distinct boxed values can be treated as a change even when their contents are equal.