Class SelectorFormComponent<TProperties>
Provides basic component support for selectors.
public abstract class SelectorFormComponent<TProperties> : FormComponent<TProperties, string> where TProperties : SelectorProperties, new()
Type Parameters
TPropertiesProperties type of the form component.
- Inheritance
-
objectFormComponent<TProperties, string>SelectorFormComponent<TProperties>
- Derived
- Inherited Members
- Extension Methods
Remarks
Selected value is of string type.
Constructors
SelectorFormComponent()
protected SelectorFormComponent()
Properties
HtmlOptions
Gets the collection of items populated in component.
public IEnumerable<HtmlOptionItem> HtmlOptions { get; }
Property Value
- IEnumerable<HtmlOptionItem>
LabelForPropertyName
Gets name of the SelectedValue property.
public override string LabelForPropertyName { get; }
Property Value
- string
SelectedValue
Gets or sets value selected by component.
[BindableProperty]
public virtual string SelectedValue { get; set; }
Property Value
- string
Methods
GetHtmlOptions()
Returns collection of items populated in component.
protected virtual IEnumerable<HtmlOptionItem> GetHtmlOptions()
Returns
- IEnumerable<HtmlOptionItem>
GetValue()
Gets the SelectedValue property.
public override string GetValue()
Returns
- string
LoadProperties(FormComponentProperties)
Loads properties of the form component. The actual properties type must match the PropertiesType.
public override void LoadProperties(FormComponentProperties properties)
Parameters
propertiesFormComponentPropertiesForm component properties to be loaded.
Exceptions
- ArgumentNullException
Thrown when
propertiesare null.- ArgumentException
Thrown when
propertiesdo not match the PropertiesType.
SetValue(string)
Sets the SelectedValue property.
public override void SetValue(string value)
Parameters
valuestring
Validate(ValidationContext)
Performs validation on SelectedValue property checking whether such value is present in HtmlOptions.
public override IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
Parameters
validationContextValidationContextThe validation context.
Returns
- IEnumerable<ValidationResult>
Collection holding validation results.