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
EnumNames
public IReadOnlyList<string> EnumNames { get; }
Property Value
Kind
How the dialog displays and edits this field.
public TwCalendarDialogFieldKind Kind { get; }
Property Value
Label
The label shown beside the value.
public string Label { get; }
Property Value
Name
The name of the property on Value.
public string Name { get; }
Property Value
Methods
GetBool(object?)
public bool GetBool(object? target)
Parameters
targetobject
Returns
GetDateTime(object?, DateTime)
Gets a date property's value, or fallback when it is null.
public DateTime GetDateTime(object? target, DateTime fallback)
Parameters
Returns
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
targetobject
Returns
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
targetobjectThe object the field belongs to.
localizerITwLocalizerSupplies 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
targetobject
Returns
GetValue(object?)
Gets the raw property value from target.
public object? GetValue(object? target)
Parameters
targetobject
Returns
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
typeTypepropertiesIReadOnlyDictionary<string, string>
Returns
SetBool(object, bool)
Sets a bool property.
public void SetBool(object target, bool value)
Parameters
SetDateTime(object, DateTime)
Sets a DateTime or DateTimeOffset property.
public void SetDateTime(object target, DateTime value)
Parameters
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)