New to Telerik UI for Blazor? Download free 30-day trial

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 or taps the increase/decrease buttons; and after the user stops dragging the handle; and when the user clicks on the track.

The event does not fire continuously while the user is dragging the handle because that would re-render the component and cause both poor performance, and the user to stop dragging because the element they are dragging will disappear.

Handle ValueChanged

@*This example showcases one-way data binding by using Value and ValueChanged*@

@TheValue
<br /><br />
<TelerikSlider Value="@TheValue" ValueChanged="@( (int v) => ValueChangedHandler(v))"
               SmallStep="10" LargeStep="20" Min="0" Max="100" Width="500px">
</TelerikSlider>

@code{
    int TheValue { get; set; } = 30;

    async Task ValueChangedHandler(int v)
    {
        // update the view-model to let the change render
        // if you avoid that, you wil effectively cancel the event
        TheValue = v;

        Console.WriteLine($"The user has now chosen {v}");
    }
}

The event is an EventCallback and it can be synchronous (return void), or it can also be asynchronous and return async Task.

The lambda expression in the handler is required by the framework: https://github.com/aspnet/AspNetCore/issues/12226.

See Also

In this article
Not finding the help you need? Improve this article