Class SingleSelectComponent<T, TListElement>
A DRY inspired abstract class providing MBSelect<TItem> and MBRadioButtonGroup<TItem> with validation.
public abstract class SingleSelectComponent<T, TListElement> : InputComponent<T>, IComponent, IHandleEvent, IHandleAfterRender, IDisposable where TListElement : MBSelectElement<T>
Type Parameters
T
TListElement
- Inheritance
-
SingleSelectComponent<T, TListElement>
- Implements
- Derived
-
MBRadioButtonGroup<TItem>MBSelect<TItem>
- Inherited Members
Constructors
SingleSelectComponent()
protected SingleSelectComponent()
Properties
GetKeysFunc
A function delegate to return the parameters for @key
attributes. If unused
"fake" keys set to GUIDs will be used.
[Parameter]
public Func<T, object> GetKeysFunc { get; set; }
Property Value
ItemValidation
The form of validation to apply when Value is first set, deciding whether to accept a value outside the Items list, replace it with the first list item or to throw an exception (the default).
Overrides ItemValidation
[Parameter]
public MBItemValidation? ItemValidation { get; set; }
Property Value
Items
The item list to be represented as radio buttons
[Parameter]
public IEnumerable<TListElement> Items { get; set; }
Property Value
- IEnumerable<TListElement>
Methods
OnParametersSetAsync()
When overriding this, call await base.OnParametersSetAsync();
before any user code unless there is a very good reason not to.
protected override Task OnParametersSetAsync()
Returns
ValidateItemList(IEnumerable<MBSelectElement<T>>, MBItemValidation)
Validates the item list against the validation specification.
public (bool hasValue, T value) ValidateItemList(IEnumerable<MBSelectElement<T>> items, MBItemValidation appliedItemValidation)
Parameters
items
IEnumerable<MBSelectElement<T>>The item list
appliedItemValidation
MBItemValidationSpecification of the required validation MBItemValidation
Returns
- (bool hasValue, T value)
The an indicator of whether an item was found and the item in the list matching Material.Blazor.Internal.InputComponent`1._cachedValue or default if not found.