Table of Contents

Class FieldBase<T>

Namespace
The.WPF.Fields
Assembly
Instagile.WPF.dll
[JsonConverter(typeof(FieldJsonConverter))]
public abstract class FieldBase<T> : FieldBase, IField<T>, IField, IModel, INotifyPropertyChanged, IDataErrorInfo

Type Parameters

T
Inheritance
FieldBase<T>
Implements
Derived
Inherited Members
Extension Methods

Constructors

FieldBase(ISurface, string, string)

protected FieldBase(ISurface surface, string label, string @namespace)

Parameters

surface ISurface
label string
namespace string

Fields

Logger

protected readonly ILogger Logger

Field Value

ILogger

Principal

protected readonly IPrincipal Principal

Field Value

IPrincipal

Services

protected readonly IServices Services

Field Value

IServices

Properties

Content

Templated field content

public virtual IField Content { get; }

Property Value

IField

DisplayError

The text surfaced through binding validation. Validate() results by default; subclasses may add display-only content (e.g. warnings) which does not affect Error or validity.

protected override string? DisplayError { get; }

Property Value

string

FindingAdvice

The most severe sub-error finding supplied via SetFindings(IReadOnlyList<ValidationFinding>, IReadOnlyList<ValidationFinding>), if any. Advice is display-only: it does not affect IsValid, and it is shown only when there is no error to show instead.

protected (MessageLevel Level, string Message)? FindingAdvice { get; }

Property Value

(MessageLevel Level, string Message)?

FindingError

The current error-level finding message supplied via SetFindings(IReadOnlyList<ValidationFinding>, IReadOnlyList<ValidationFinding>), if any.

protected string? FindingError { get; }

Property Value

string

HasChanges

public abstract bool HasChanges { get; }

Property Value

bool

HasLabel

True if the field should be labelled inline

public virtual bool HasLabel { get; }

Property Value

bool

HelpText

Optional tooltip, displayed if a label is also displayed

public virtual string? HelpText { get; }

Property Value

string

IsEditable

public virtual bool IsEditable { get; }

Property Value

bool

IsValid

public virtual bool IsValid { get; }

Property Value

bool

IsVisible

True if the field should be displayed

public virtual bool IsVisible { get; }

Property Value

bool

Label

Caption to display alongside the field content

public string Label { get; }

Property Value

string

Rules

protected IEnumerable<Rule<T>> Rules { get; }

Property Value

IEnumerable<Rule<T>>

Surface

public ISurface Surface { get; }

Property Value

ISurface

Tag

public string? Tag { get; set; }

Property Value

string

Text

Text summary of the field's value (for on screen summaries)

public virtual string Text { get; }

Property Value

string

Value

The lensed value which this field is modelling

public abstract T Value { get; set; }

Property Value

T

Methods

AddRule(Rule<T>, bool)

public void AddRule(Rule<T> r, bool mayHaveDependencies)

Parameters

r Rule<T>
mayHaveDependencies bool

ClearRules()

public void ClearRules()

Invalidate()

Update the current value on the form, unless it has not been saved to the model, and perform validation

public void Invalidate()

OnRulesChanged()

protected virtual void OnRulesChanged()

SetFindings(IReadOnlyList<ValidationFinding>, IReadOnlyList<ValidationFinding>)

Display findings from a ValidationSession. anchored are pre-matched to this field's bound property with display policy applied, and merge with the field's own rules; descendants are the policy-filtered findings for the wider graph, which collection fields forward to their subscreens. Wrapping fields forward both to their content.

public virtual void SetFindings(IReadOnlyList<ValidationFinding> anchored, IReadOnlyList<ValidationFinding> descendants)

Parameters

anchored IReadOnlyList<ValidationFinding>
descendants IReadOnlyList<ValidationFinding>

SetViewFromModelAndNotify()

public void SetViewFromModelAndNotify()

Validate()

public override string? Validate()

Returns

string