/// <summary> /// Adds the item. /// </summary> /// <param name="item">The item.</param> public void AddItem(RadzenRadioButtonListItem <TValue> item) { if (items.IndexOf(item) == -1) { items.Add(item); StateHasChanged(); } }
/// <summary> /// Removes the item. /// </summary> /// <param name="item">The item.</param> public void RemoveItem(RadzenRadioButtonListItem <TValue> item) { if (items.Contains(item)) { items.Remove(item); try { InvokeAsync(StateHasChanged); } catch { } } }
/// <summary> /// Selects the item. /// </summary> /// <param name="item">The item.</param> protected async System.Threading.Tasks.Task SelectItem(RadzenRadioButtonListItem <TValue> item) { if (Disabled || item.Disabled) { return; } Value = item.Value; await ValueChanged.InvokeAsync(Value); if (FieldIdentifier.FieldName != null) { EditContext?.NotifyFieldChanged(FieldIdentifier); } await Change.InvokeAsync(Value); StateHasChanged(); }
ClassList IconClassList(RadzenRadioButtonListItem <TValue> item) => ClassList.Create("rz-radiobutton-icon") .Add("rzi rzi-circle-on", IsSelected(item));
ClassList ItemClassList(RadzenRadioButtonListItem <TValue> item) => ClassList.Create("rz-radiobutton-box") .Add("rz-state-active", IsSelected(item)) .AddDisabled(Disabled || item.Disabled);
/// <summary> /// Determines whether the specified item is selected. /// </summary> /// <param name="item">The item.</param> /// <returns><c>true</c> if the specified item is selected; otherwise, <c>false</c>.</returns> protected bool IsSelected(RadzenRadioButtonListItem <TValue> item) { return(object.Equals(Value, item.Value)); }