Ejemplo n.º 1
0
        protected async Task HandleOnChanged(UIChangeEventArgs e)
        {
            if (IsMultiple)
            {
                // when multiple selection is enabled we need to use javascript to get the list of selected items
                internalMultiValue = await JSRunner.GetSelectedOptions <TValue>(ElementId);

                // changed event must be called before validation
                await SelectedValuesChanged.InvokeAsync(internalMultiValue);

                ParentValidation?.UpdateInputValue(internalMultiValue);
            }
            else
            {
                if (Converters.TryChangeType <TValue>(e.Value, out var value))
                {
                    internalValue = value;
                }
                else
                {
                    internalValue = default;
                }

                // changed event must be called before validation
                await SelectedValueChanged.InvokeAsync(internalValue);

                ParentValidation?.UpdateInputValue(internalValue);
            }
        }