mirror of
https://github.com/PacktPublishing/Web-Development-with-Blazor-Second-Edition.git
synced 2025-12-06 05:32:03 +01:00
23 lines
958 B
C#
23 lines
958 B
C#
|
|
using System.Diagnostics.CodeAnalysis;
|
|||
|
|
using Microsoft.AspNetCore.Components.Rendering;
|
|||
|
|
namespace Microsoft.AspNetCore.Components.Forms;
|
|||
|
|
public class InputTextAreaOnInput :
|
|||
|
|
InputBase<string?>
|
|||
|
|
{
|
|||
|
|
protected override void BuildRenderTree(RenderTreeBuilder builder)
|
|||
|
|
{
|
|||
|
|
builder.OpenElement(0, "textarea");
|
|||
|
|
builder.AddMultipleAttributes(1, AdditionalAttributes);
|
|||
|
|
builder.AddAttribute(2, "class", CssClass);
|
|||
|
|
builder.AddAttribute(3, "value", BindConverter.FormatValue(CurrentValue));
|
|||
|
|
builder.AddAttribute(4, "oninput", EventCallback.Factory.CreateBinder<string?>(this, __value => CurrentValueAsString = __value, CurrentValueAsString));
|
|||
|
|
builder.CloseElement();
|
|||
|
|
}
|
|||
|
|
protected override bool TryParseValueFromString(string? value, out string? result, [NotNullWhen(false)] out string? validationErrorMessage)
|
|||
|
|
{
|
|||
|
|
result = value;
|
|||
|
|
validationErrorMessage = null;
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
}
|