Can NumericTextBox Format Be Updatedat run time? In other words, if numerictextbox is being used for dimensions and the user changes the preferred dimensional unit from "centimeters" to "inches" can the Format be changed from "0.## cm" to "0.## in" at runtime?
Same applies if I want to dynamically change the Decimals or Step values. Currently it looks like a dynamic change in the NumericTextBox parameters is not possible.
---
ADMIN EDIT
Here is a workaround that re-initializes the component:
<TelerikButton OnClick="@ChangeFormat">Change format</TelerikButton>
<br />
The value is: @theValue
<br />
@if (isVisible) {
<TelerikNumericTextBox Format="@theFormat" Max="5m" Min="-5m" Step="0.33m" @bind-Value="@theValue"></TelerikNumericTextBox>
}
@code {
private decimal theValue { get; set; } = 1.234m;
string theFormat { get; set; } = "0.## cm";
bool isVisible { get; set; } = true;
async Task ChangeFormat()
{
//workaround
isVisible = false;
await Task.Delay(30);
await InvokeAsync(StateHasChanged);
// change the format
theFormat = "0.## in";
//workaround
isVisible = true;
//await InvokeAsync(StateHasChanged);
}
}
---