Table of Contents

Class TwCalendarDialogField

Namespace
TwBlazor.Components
Assembly
TwBlazor.dll

One property of Value that the event dialog shows (and, when it has a public setter, edits). Built from DialogProperties via reflection.

public sealed class TwCalendarDialogField
Inheritance
TwCalendarDialogField
Inherited Members

Properties

CanEdit

Whether the dialog can edit this field: the property needs a public setter and a supported type.

public bool CanEdit { get; }

Property Value

bool

EnumNames

The names of the enum's members when Kind is Enum.

public IReadOnlyList<string> EnumNames { get; }

Property Value

IReadOnlyList<string>

Kind

How the dialog displays and edits this field.

public TwCalendarDialogFieldKind Kind { get; }

Property Value

TwCalendarDialogFieldKind

Label

The label shown beside the value.

public string Label { get; }

Property Value

string

Name

The name of the property on Value.

public string Name { get; }

Property Value

string

Methods

GetBool(object?)

Gets a bool property's value, treating null as false.

public bool GetBool(object? target)

Parameters

target object

Returns

bool

GetDateTime(object?, DateTime)

Gets a date property's value, or fallback when it is null.

public DateTime GetDateTime(object? target, DateTime fallback)

Parameters

target object
fallback DateTime

Returns

DateTime

GetDisplayText(object?)

Gets the value as display text: dates as d MMM yyyy HH:mm, booleans as Yes/No, an empty string for null.

public string GetDisplayText(object? target)

Parameters

target object

Returns

string

GetDisplayText(object?, ITwLocalizer)

Gets the value as display text in the current language: dates in the localized date and time formats, booleans as the localized Yes/No, an empty string for null.

public string GetDisplayText(object? target, ITwLocalizer localizer)

Parameters

target object

The object the field belongs to.

localizer ITwLocalizer

Supplies the text and the date and time formats.

Returns

string

The display text.

GetEditText(object?)

Gets the value as text for a text or number input. Uses the invariant culture so a number input always receives a . decimal separator.

public string GetEditText(object? target)

Parameters

target object

Returns

string

GetValue(object?)

Gets the raw property value from target.

public object? GetValue(object? target)

Parameters

target object

Returns

object

Resolve(Type, IReadOnlyDictionary<string, string>?)

Builds the fields for the properties named in properties (property name to label) on type, in the dictionary's order. Names that don't match a public readable instance property are skipped. An empty label falls back to the property name split into words, so OrderNumber shows as "Order number".

public static IReadOnlyList<TwCalendarDialogField> Resolve(Type type, IReadOnlyDictionary<string, string>? properties)

Parameters

type Type
properties IReadOnlyDictionary<string, string>

Returns

IReadOnlyList<TwCalendarDialogField>

SetBool(object, bool)

Sets a bool property.

public void SetBool(object target, bool value)

Parameters

target object
value bool

SetDateTime(object, DateTime)

Sets a DateTime or DateTimeOffset property.

public void SetDateTime(object target, DateTime value)

Parameters

target object
value DateTime

SetFromText(object, string?)

Sets the property from text typed into a text, number or select input. Text that can't be parsed is ignored, leaving the property unchanged; empty text clears a nullable property.

public bool SetFromText(object target, string? text)

Parameters

target object
text string

Returns

bool

true when the property was changed.