Events
This article showcases the available events in the Telerik Slider component:
ValueChanged
The ValueChanged event fires every time the Value parameter changes. This happens when the user:
- clicks on the increase/decrease buttons;
- clicks on the track;
- while dragging the handle;
As of version 2.28.0 of Telerik UI for Blazor, the
ValueChangedevent fires continuously while the user is dragging the handle to ensure updating the value accordingly and deliver live UX. Thus, the component will re-render multiple times during the dragging process. If you want to avoid that, you can handle theOnChangeevent instead.
Handle the ValueChanged
The event is an
EventCallback. It can be synchronous and returnvoid, or asynchronous and returnasync Task. Do not useasync void.
The lambda expression in the handler is required by the framework: https://github.com/aspnet/AspNetCore/issues/12226.
OnChange
The OnChange event represents a user action - confirmation of the current value. It fires when the user:
- clicks on the increase/decrease buttons;
- clicks on the track;
- after the user stops dragging the handle;
If you use two-way binding, the ValueChanged event will fire continuously while the user is dragging the handle. This will result in continuous component re-rendering. If you want to avoid that, use one-way binding and update the value for the view-model in the OnChange event handler.
The
OnChangeevent is a custom event and does not interfere with bindings, so you can use it together with models and forms.
Handle the OnChange event
The event is an
EventCallback. It can be synchronous and returnvoid, or asynchronous and returnasync Task. Do not useasync void.