Class SfSlider
A material design for SfSlider.
Implements
Inherited Members
Namespace: Syncfusion.Maui.Sliders
Assembly: Syncfusion.Maui.Sliders.dll
Syntax
public class SfSlider : SliderBase<double>, IDrawableLayout, IDrawable, IAbsoluteLayout, ILayout, IView, IElement, ITransform, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, ISafeAreaView, IPadding, ICrossPlatformLayout, IVisualTreeElement, ISemanticsProvider, ITouchListener, ITapGestureListener, IPanGestureListener, IGestureListener, IInteractionState, IOrientationElement, IRangeView<double>, INumericElement, IParentThemeElement, IThemeElement
Constructors
SfSlider()
Initializes a new instance of the SfSlider class.
Declaration
public SfSlider()
Fields
LabelTemplateProperty
The backing store for the LabelTemplate field.
Declaration
public static readonly BindableProperty LabelTemplateProperty
Field Value
| Type | Description |
|---|---|
| Microsoft.Maui.Controls.BindableProperty | Microsoft.Maui.Controls.BindableProperty. |
NumberFormatProperty
The backing store for the NumberFormat field.
Declaration
public static readonly BindableProperty NumberFormatProperty
Field Value
| Type | Description |
|---|---|
| Microsoft.Maui.Controls.BindableProperty | Microsoft.Maui.Controls.BindableProperty. |
StepSizeProperty
The backing store for the StepSize field.
Declaration
public static readonly BindableProperty StepSizeProperty
Field Value
| Type | Description |
|---|---|
| Microsoft.Maui.Controls.BindableProperty | Microsoft.Maui.Controls.BindableProperty. |
Properties
LabelTemplate
Gets or sets the Microsoft.Maui.Controls.DataTemplate used to customize the visual representation of labels displayed in the slider.
Declaration
public DataTemplate LabelTemplate { get; set; }
Property Value
| Type | Description |
|---|---|
| Microsoft.Maui.Controls.DataTemplate | A Microsoft.Maui.Controls.DataTemplate that defines the visual representation of each slider label. |
Remarks
When a template is provided, slider labels are generated using the specified template instead of the default text-based rendering. The binding context for each template instance is a SliderLabelInfo object, which provides information about the corresponding label. This property is applicable only when ShowLabels is set to true.
If this property is null, slider labels are displayed using the default label presentation.
Examples
Snippet for SfSlider
<sliders:SfSlider ShowLabels="True">
<sliders:SfSlider.LabelTemplate>
<DataTemplate>
<Label Text="{Binding Text}" FontSize="12" />
</DataTemplate>
</sliders:SfSlider.LabelTemplate>
</sliders:SfSlider>
NumberFormat
Gets or sets the value to format the label text.
Declaration
public string NumberFormat { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | Defaults to |
Examples
StepSize
Gets or sets the value indicating whether to select the discrete value.
For example, if Minimum is 0.0 and Maximum is 10.0 and StepSize is 2.0, then the slider will move the thumb positions to 0.0, 2.0, 4.0, 6.0, 8.0 and 10.0 only.
Declaration
public double StepSize { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | Defaults to |
Remarks
StepSize does not work with BetweenThumbs.
Examples
Snippet for SfSlider
Events
ValueChanged
Represents the ValueChanged event, which occurs when the user is done selecting a new value for the slider.
Declaration
public event EventHandler<SliderValueChangedEventArgs> ValueChanged
Event Type
| Type |
|---|
| System.EventHandler<SliderValueChangedEventArgs> |
Examples
ValueChanging
Represents the ValueChanging event, which occurs when the user is selecting a new value for the Slider by dragging the thumb.
Declaration
public event EventHandler<SliderValueChangingEventArgs> ValueChanging
Event Type
| Type |
|---|
| System.EventHandler<SliderValueChangingEventArgs> |
Examples
Explicit Interface Implementations
INumericElement.OnLabelTemplateChanged()
Clears all generated label template views and refreshes the control layout when the LabelTemplate property changes.
Declaration
void INumericElement.OnLabelTemplateChanged()
INumericElement.OnNumberFormatChanged(String, String)
Declaration
void INumericElement.OnNumberFormatChanged(string oldValue, string newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | oldValue | |
| System.String | newValue |
INumericElement.OnStepChanged()
Declaration
void INumericElement.OnStepChanged()