Skip to main content
Version: 4.2

DiffViewer

Namespace: Wisej.Web

Assembly: Wisej.Framework (4.2.0.0)

Compares named fields of two records and displays their old and new values.

public class DiffViewer : Control

Supports string-keyed IDictionary records, generic string/object dictionaries and readable component-model properties. Names use ordinal, case-sensitive matching. Empty Fields discovers the sorted union of both records' browsable properties or keys; explicit Fields preserves order. Equality uses object.Equals without coercion or recursive comparison. Missing differs from null. Objects are application-owned and are not observed; call RefreshComparison after in-place edits. Property getter or format errors propagate to the caller. Only formatted text is sent to the browser.

Example:

var viewer = new DiffViewer {
OldValue = new { Stage = "Proposal", Amount = 212000m },
NewValue = new { Stage = "Negotiation", Amount = 248000m },
AllowRevert = true
};
viewer.Fields.Add(new DiffField { Name = "Amount", Format = "{0:C0}" });
viewer.RevertClick += (sender, e) => Console.WriteLine(e.Field.Name);
this.Controls.Add(viewer);

Constructors​

Instance member DiffViewer()​

Creates a comparison with automatic fields and unchanged rows visible.

Properties​

Instance member AllowRevert​

Boolean: Gets or sets whether changed fields offer a revert request button. (Default: False)

Instance member Caption​

String: Gets or sets the plain-text footer caption, for example the editor and timestamp. (Default: "")

Instance member ChangesText​

String: Gets or sets the composite format for the changed-field count. (Default: null)

The default is null, which uses the built-in text for the current UI culture. An empty string suppresses the text without disabling the operation. The composite format placeholder {0} is the number of changed, nonignored fields. Formatting uses CurrentCulture; translation selection uses CurrentUICulture. Literal braces must be escaped as {{ and }}.

Example:

var control = new DiffViewer();
control.ChangesText = "{0} modified fields";
control.ChangesText = null; // Restore the built-in localized text.

Protected member DefaultSize​

Size: Gets the initial comparison surface size.

Instance member Fields​

DiffFieldCollection: Gets the ordered field descriptors. Empty enables automatic discovery.

Instance member Focusable​

Boolean: Gets or sets whether the viewer can receive the focus. The default is false. (Default: False)

Instance member HideText​

String: Gets or sets the composite format for the hide-unchanged button caption. (Default: null)

The default is null, which uses the built-in text for the current UI culture. An empty string suppresses the text without disabling the operation. The composite format placeholder {0} is the number of unchanged, nonignored fields. Formatting uses CurrentCulture. Literal braces must be escaped as {{ and }}.

Instance member IgnoreFields​

String[]: Gets or sets exact field names excluded from both automatic and explicit fields.

The array is copied on assignment and retrieval. Null resets to an empty array.

Instance member MissingText​

String: Gets or sets the text displayed for an absent field. (Default: null)

The default is null, which uses the built-in text for the current UI culture. An empty string suppresses the text without disabling the operation.

Instance member Mode​

DiffViewerMode: Gets or sets the value layout. The default is SideBySide. (Default: SideBySide)

Instance member NewValue​

Object: Gets or sets the new application-owned record. Null has no fields. (Default: null)

Instance member NullText​

String: Gets or sets the text displayed for a null field value. (Default: null)

The default is null, which uses the built-in text for the current UI culture. An empty string suppresses the text without disabling the operation.

Instance member OldValue​

Object: Gets or sets the old application-owned record. Null has no fields. (Default: null)

Instance member RevertText​

String: Gets or sets the revert button tooltip. (Default: null)

The default is null, which uses the built-in text for the current UI culture. An empty string suppresses the text without disabling the operation.

Instance member ShowText​

String: Gets or sets the composite format for the show-unchanged button caption. (Default: null)

The default is null, which uses the built-in text for the current UI culture. An empty string suppresses the text without disabling the operation. The composite format placeholder {0} is the number of unchanged, nonignored fields. Formatting uses CurrentCulture. Literal braces must be escaped as {{ and }}.

Instance member ShowUnchanged​

Boolean: Gets or sets whether unchanged fields are visible. The footer can toggle this property. (Default: True)

Instance member TabStop​

Boolean: Gets or sets whether the viewer takes part in tab navigation. The default is false. (Default: False)

Instance member UnchangedText​

String: Gets or sets the caption for an unchanged field. (Default: null)

The default is null, which uses the built-in text for the current UI culture. An empty string suppresses the text without disabling the operation.

Methods​

Protected member Dispose(disposing)​

Releases field observers without disposing either application-owned record.

ParameterTypeDescription
disposingBooleanWhether managed resources can be released.

Protected member OnFieldClick(e)​

Raises FieldClick.

ParameterTypeDescription
eDiffFieldEventArgsThe rendered field comparison.

Protected member OnRevertClick(e)​

Raises RevertClick.

ParameterTypeDescription
eDiffFieldEventArgsThe rendered field comparison.

Protected member OnWebEvent(e)​

Dispatches browser interactions to validated processors.

ParameterTypeDescription
eWisejEventArgsClient event data.

Protected member OnWebRender(config)​

Renders first-level options and a versioned text-only comparison snapshot.

ParameterTypeDescription
configObjectClient configuration.

Instance member RefreshComparison()​

Invalidates the rendered comparison after in-place changes to either record.

Example:

newRecord["Stage"] = "Approved";
viewer.RefreshComparison();

Events​

Instance member FieldClick​

EventHandler<DiffFieldEventArgs> Occurs when a displayed field is activated by mouse or keyboard.

Instance member RevertClick​

EventHandler<DiffFieldEventArgs> Occurs when a changed field requests a revert; neither record is modified.

Implements​

NameDescription
IUserDataProvides access to the UserData and Tag properties associated to the component implementing this interface.
IBindableComponentBindable components implement this interface.
IDropTargetControls that support drag & drop operations implement this interface.
IWisejComponentAll wisej components implement this interface.
IWisejControlAll wisej controls derived from the Control class must implement this interface.
IWisejSerializableAllows an object to serialize itself.