RadzenSlider - passing in callback - name vs lambda

Hello!

I posted a question about RadzenSlider here:

It's mostly out of curiosity as the issue is resolved (I used the "works" slider as described there).

Just curious as to what would cause the difference in behavior described there.

Thanks for Radzen Blazor!

I've been using it in a small demo application:

Ed

Hi @dharmatech,

Not sure what can cause such behavior. Our demos are using exactly such syntax:

1 Like

Hi enchev,

Thank you for taking a look.

I was able to solve the issue. Answer is here:

Ed

Hi @dharmatech,

The reason why Action doesn't work while EventCallback does is that Blazor does some magic for the latter - calls StateHasChanged() implicitly after the callback code runs.

1 Like

Ah, ok, that makes sense. :+1: Thank you for the explanation!

So, with the above sorted out, my app seems to be working. However, I received feedback from someone regarding the component implementation. They basically said it's a bad idea to change the component parameter from the setter.

Here's the full details regarding their critique:

Now, as far as I can tell, what they're saying not to do seems to be exactly how RadzenSlider is implemented. I.e. the setter of Value changes the parameter value:

From this I'm taking that perhaps its not so bad to do this after all?

Thanks for any suggestions or thoughts. :slight_smile:

Value property of all Radzen form components including RadzenSlider is especially designed to support two-way binding (it has ValueChanged callback) and this is how every two way bindable property should work.

1 Like

I've posted an answer there which doesn't use the parameter setter to change the value: