A custom component has been created.
How do I dynamically align text?
* It does not work when configured as below.
SfTextBox TextBoxObj = new();
protected override void OnInitialized()
{
switch (p_Type)
{
case "1":
_type = Syncfusion.Blazor.Inputs.InputType.Text;
break;
case "2":
_type = Syncfusion.Blazor.Inputs.InputType.Password;
break;
case "3":
_type = Syncfusion.Blazor.Inputs.InputType.Number;
break;
case "4":
_type = Syncfusion.Blazor.Inputs.InputType.Email;
break;
case "5":
_type = Syncfusion.Blazor.Inputs.InputType.Search;
break;
default:
_type = Syncfusion.Blazor.Inputs.InputType.Text;
break;
}
_readonly = (p_Readonly == null || p_Readonly == "" || p_Readonly == "F") ? false : true;
_enabled = p_Enabled == null ? true : (bool)p_Enabled;
_align = (p_Align == null || p_Align == "C") ? "center" : (p_Align == "L" ? "left" : "right");
_ShowClearButton = (p_ShowClearButton == null || p_ShowClearButton == "" || p_ShowClearButton == "T") ? true : false;
_value = (p_Value == null ? "" : p_Value);
switch (p_Align)
{
case "C":
_align = "Center";
break;
case "L":
_align = "Left";
break;
case "R":
_align = "Right";
break;
default:
_align = "Center";
break;
}
TextBoxObj.HtmlAttributes = new() { { "style", "text-align:" + _align } };
StateHasChanged();