Ejemplo n.º 1
0
    protected async Task InputCheckedChange(ChangeEventArgs args)
    {
        if (args != null && args.Value is bool value)
        {
            // A somewhat kludgy attempt at adding a third state with minimal disruption
            // in the original behavior.  It has the inelegant effect of cycling through
            // the third (null/indeterminate) state twice in a full cycle, once after each
            // of the other states (true/false), instead of just once in a sequental series.
            bool?newValue = value;
            if ((_lastNullValue == null && Value.HasValue) || (Value.HasValue && Value.Value == _lastNullValue))
            {
                _lastNullValue = !Value.Value;
                newValue       = null;
            }

            await base.ChangeValue(newValue);

#pragma warning disable CS0618             // Type or member is obsolete
            if (CheckedChange.HasDelegate) // kept for compatibility reasons with previous versions
            {
                await CheckedChange.InvokeAsync(newValue);
            }
#pragma warning restore CS0618 // Type or member is obsolete
        }
    }
        protected async Task InputCheckedChange(ChangeEventArgs args)
        {
            if (args != null && args.Value is bool value)
            {
                await base.ChangeValue(value);

                if (CheckedChange.HasDelegate) //kept for compatibility reasons with previous versions
                {
                    await CheckedChange.InvokeAsync(value);
                }
                CheckboxGroup?.OnCheckboxChange(this);
            }
        }