Class FieldBase<T>
[JsonConverter(typeof(FieldJsonConverter))]
public abstract class FieldBase<T> : FieldBase, IField<T>, IField, IModel, INotifyPropertyChanged, IDataErrorInfo
Type Parameters
T
- Inheritance
-
FieldBase<T>
- Implements
-
IField<T>
- Derived
- Inherited Members
- Extension Methods
Constructors
FieldBase(ISurface, string, string)
protected FieldBase(ISurface surface, string label, string @namespace)
Parameters
Fields
Logger
protected readonly ILogger Logger
Field Value
Principal
protected readonly IPrincipal Principal
Field Value
Services
protected readonly IServices Services
Field Value
Properties
Content
Templated field content
public virtual IField Content { get; }
Property Value
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
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
FindingError
The current error-level finding message supplied via SetFindings(IReadOnlyList<ValidationFinding>, IReadOnlyList<ValidationFinding>), if any.
protected string? FindingError { get; }
Property Value
HasChanges
public abstract bool HasChanges { get; }
Property Value
HasLabel
True if the field should be labelled inline
public virtual bool HasLabel { get; }
Property Value
HelpText
Optional tooltip, displayed if a label is also displayed
public virtual string? HelpText { get; }
Property Value
IsEditable
public virtual bool IsEditable { get; }
Property Value
IsValid
public virtual bool IsValid { get; }
Property Value
IsVisible
True if the field should be displayed
public virtual bool IsVisible { get; }
Property Value
Label
Caption to display alongside the field content
public string Label { get; }
Property Value
Rules
protected IEnumerable<Rule<T>> Rules { get; }
Property Value
- IEnumerable<Rule<T>>
Surface
public ISurface Surface { get; }
Property Value
Tag
public string? Tag { get; set; }
Property Value
Text
Text summary of the field's value (for on screen summaries)
public virtual string Text { get; }
Property Value
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
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
anchoredIReadOnlyList<ValidationFinding>descendantsIReadOnlyList<ValidationFinding>
SetViewFromModelAndNotify()
public void SetViewFromModelAndNotify()
Validate()
public override string? Validate()