.NET MAUI Slider Events
The Telerik UI for .NET MAUI Slider component exposes a ValueChanging
event which is raised when the end user drags the thumb or touches the range track. You can use this event to plug custom logic by changing the Value
property.
The ValueChanging
event handler receives two parameters:
- The sender argument, which is of type
object
, but can be cast to theRadSlider
type. - A
Telerik.Maui.ValueChangingEventArgs
object, which provides theValue
property of the Slider.
The following example demonstrates how to use the ValueChanging
event to prevent dragging the thumb to a smaller value:
1. Define the Slider:
<telerik:RadSlider Minimum="0"
Maximum="100"
Value="35"
ValueChanging="Slider_ValueChanging" />
2. Add the event handler:
private void Slider_ValueChanging(object sender, Telerik.Maui.ValueChangingEventArgs e)
{
var slider = (RadSlider)sender;
if (e.Value < 20)
{
e.Value = slider.Value;
}
}