Class SliderChangeEventArgs<T>
Represents the event arguments for the Slider Change and Changed events.
Inheritance
Namespace: Syncfusion.Blazor.Inputs
Assembly: Syncfusion.Blazor.dll
Syntax
public class SliderChangeEventArgs<T> : Object
Type Parameters
Name | Description |
---|---|
T | The type of the slider value. |
Remarks
This class provides comprehensive information about slider value changes, including the previous and current values,
whether the change was initiated by user interaction, and additional metadata about the change event.
The generic type parameter allows the slider to work with various value types such as int
, double
, or custom types.
Examples
Using SliderChangeEventArgs in a Blazor Slider component:
<SfSlider @bind-Value="sliderValue" TValue="int" Min="0" Max="100">
<SliderEvents TValue="int" ValueChange="OnSliderValueChange" />
</SfSlider>
@code {
private int sliderValue = 30;
private void OnSliderValueChange(SliderChangeEventArgs<int> args)
{
Console.WriteLine($"Previous: {args.PreviousValue}, Current: {args.Value}");
Console.WriteLine($"User Initiated: {args.IsInteracted}");
}
}
Constructors
SliderChangeEventArgs()
Declaration
public SliderChangeEventArgs()
Properties
IsInteracted
Gets or sets a value indicating whether the event was triggered by user interaction or programmatically.
Declaration
public bool IsInteracted { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
This property is useful for distinguishing between user-initiated changes and programmatic updates to the slider value. It allows developers to implement different logic based on the source of the value change, such as validation or custom behaviors.
Name
Gets or sets the action applied on the Slider.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String | A |
Remarks
This property indicates the specific action that triggered the slider event, such as "drag", "click", or other slider interactions. It helps identify the type of user interaction that caused the value change.
PreviousValue
Gets or sets the previous value of the Slider before the change occurred.
Declaration
public T PreviousValue { get; set; }
Property Value
Type | Description |
---|---|
T | The value of type |
Remarks
This property provides access to the slider's value before the current change event was triggered. It is particularly useful for implementing undo functionality, validation logic, or tracking value changes over time.
Text
Gets or sets the formatted text representation of the current slider value displayed in the tooltip.
Declaration
public string Text { get; set; }
Property Value
Type | Description |
---|---|
System.String | A |
Remarks
This property contains the human-readable text representation of the slider value that is displayed in tooltips. The text may be formatted according to the slider's formatting options, culture settings, or custom formatting rules.
Value
Gets or sets the current value of the Slider after the change.
Declaration
public T Value { get; set; }
Property Value
Type | Description |
---|---|
T | The current value of type |
Remarks
This property represents the new value that the slider has been changed to during the current event. It works in conjunction with PreviousValue to provide complete information about the value transition.