Exemplo n.º 1
0
 /// <inheritdoc />
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 {
     builder.OpenElement(0, "input");
     builder.AddMultipleAttributes(1, AdditionalAttributes);
     builder.AddAttributeIfNotNullOrEmpty(2, "class", CssClass);
     builder.AddAttribute(3, "value", BindConverter.FormatValue(CurrentValue));
     builder.AddAttribute(4, "onchange", EventCallback.Factory.CreateBinder <string?>(this, __value => CurrentValueAsString = __value, CurrentValueAsString));
     builder.AddElementReferenceCapture(5, __inputReference => Element = __inputReference);
     builder.CloseElement();
 }
Exemplo n.º 2
0
    /// <inheritdoc />
    protected override void BuildRenderTree(RenderTreeBuilder builder)
    {
        Debug.Assert(Context != null);

        builder.OpenElement(0, "input");
        builder.AddMultipleAttributes(1, AdditionalAttributes);
        builder.AddAttributeIfNotNullOrEmpty(2, "class", AttributeUtilities.CombineClassNames(AdditionalAttributes, Context.FieldClass));
        builder.AddAttribute(3, "type", "radio");
        builder.AddAttribute(4, "name", Context.GroupName);
        builder.AddAttribute(5, "value", BindConverter.FormatValue(Value?.ToString()));
        builder.AddAttribute(6, "checked", Context.CurrentValue?.Equals(Value));
        builder.AddAttribute(7, "onchange", Context.ChangeEventCallback);
        builder.CloseElement();
    }
Exemplo n.º 3
0
        /// <inheritdoc />
        protected override void BuildRenderTree(RenderTreeBuilder builder)
        {
            builder.OpenElement(0, "select");
            builder.AddMultipleAttributes(1, AdditionalAttributes);
            builder.AddAttributeIfNotNullOrEmpty(2, "class", CssClass);
            builder.AddAttribute(3, "multiple", _isMultipleSelect);

            if (_isMultipleSelect)
            {
                builder.AddAttribute(4, "value", BindConverter.FormatValue(CurrentValue)?.ToString());
                builder.AddAttribute(5, "onchange", EventCallback.Factory.CreateBinder <string?[]?>(this, SetCurrentValueAsStringArray, default));
            }
            else
            {
                builder.AddAttribute(6, "value", CurrentValueAsString);
                builder.AddAttribute(7, "onchange", EventCallback.Factory.CreateBinder <string?>(this, __value => CurrentValueAsString = __value, default));
            }

            builder.AddElementReferenceCapture(8, __selectReference => Element = __selectReference);
            builder.AddContent(9, ChildContent);
            builder.CloseElement();
        }