I am pretty sure I have the code right, but the progress bar is not updating at all. Here is my code. I have also tried putting the progress bar outside the text box, but it still does not update. The call to EvaluatePassword simply returns an integer from 1-5. I basically tried all the combinations. I tried different Height, no ProgressBarAnimation, different colors and so on. Nothing works. After setting the initial value of the progress bar, it is impossible to update.
<SfTextBox Placeholder="Password" @bind-Value="@_model.Password" FloatLabelType="@FloatLabelType.Auto" Type="InputType.Password" @onkeypress='@PasswordKeyPressed'>
<SfProgressBar Type="ProgressType.Linear" Value="@PasswordScore" Height="10" Minimum="0" Maximum="100">
<ProgressBarAnimation Enable="true" Duration="1000" Delay="0"></ProgressBarAnimation>
</SfProgressBar>
</SfTextBox>
@code {
private Zxcvbn _zx = new Zxcvbn();
private int PasswordScore { get; set; }
private void PasswordKeyPressed(KeyboardEventArgs args)
{
var result = _zx.EvaluatePassword((_model.Password ?? string.Empty) + args.Key);
PasswordScore = result.Score * 20;
}
}