/// <summary>
 /// Adds the item.
 /// </summary>
 /// <param name="item">The item.</param>
 public void AddItem(RadzenCheckBoxListItem<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(RadzenCheckBoxListItem<TValue> item)
 {
     if (items.Contains(item))
     {
         items.Remove(item);
         if (!disposed)
         {
             try { InvokeAsync(StateHasChanged); } catch { }
         }
     }
 }
        /// <summary>
        /// Selects the item.
        /// </summary>
        /// <param name="item">The item.</param>
        protected async System.Threading.Tasks.Task SelectItem(RadzenCheckBoxListItem<TValue> item)
        {
            if (Disabled || item.Disabled)
                return;

            List<TValue> selectedValues = new List<TValue>(Value != null ? Value : Enumerable.Empty<TValue>());

            if (!selectedValues.Contains(item.Value))
            {
                selectedValues.Add(item.Value);
            }
            else
            {
                selectedValues.Remove(item.Value);
            }

            Value = selectedValues;

            await ValueChanged.InvokeAsync(Value);
            if (FieldIdentifier.FieldName != null) { EditContext?.NotifyFieldChanged(FieldIdentifier); }
            await Change.InvokeAsync(Value);

            StateHasChanged();
        }
 ClassList IconClassList(RadzenCheckBoxListItem<TValue> item) => ClassList.Create("rz-chkbox-icon")
                                                                     .Add("rzi rzi-check", IsSelected(item));
 ClassList ItemClassList(RadzenCheckBoxListItem<TValue> item) => ClassList.Create("rz-chkbox-box")
                                                                     .Add("rz-state-active", IsSelected(item))
                                                                     .AddDisabled(Disabled || item.Disabled);
 private string getDisabledState(RadzenCheckBoxListItem<TValue> item)
 {
     return Disabled || item.Disabled ? " rz-state-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(RadzenCheckBoxListItem<TValue> item)
 {
     return Value != null && Value.Contains(item.Value);
 }