How to display custom label in Xamarin.Android Range Slider
CustomLabels can be displayed in the SfRangeSlider using the ShowCustomLabel API.
To display custom labels, ShowCustomLabel property should be set to true and need to populate the CustomLabels property with observable collection of items by specifying the custom labels for corresponding values.
C#
public class MainActivity : AppCompatActivity { SfRangeSlider rangeSlider; List<Items> customCollection; protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); customCollection = new List<Items>(); customCollection.Add(new Items() { Label = "AM", Value = 5 }); customCollection.Add(new Items() { Label = "PM", Value = 16 }); rangeSlider = new SfRangeSlider(this); rangeSlider.ShowCustomLabel = true; rangeSlider.ShowValueLabel = true; rangeSlider.SnapsTo = SnapsTo.StepValues; rangeSlider.TickFrequency = 1; rangeSlider.Minimum = 5; rangeSlider.Maximum = 16; rangeSlider.RangeStart = 5; rangeSlider.RangeEnd = 16; rangeSlider.RangeStartChanged += RangeSlider_RangeStartChanged; rangeSlider.RangeEndChanged += RangeSlider_RangeEndChanged; rangeSlider.Orientation = Com.Syncfusion.Sfrangeslider.Orientation.Horizontal; rangeSlider.ShowRange = true; rangeSlider.TickPlacement = TickPlacement.Inline; rangeSlider.CustomLabels = customCollection; SetContentView(rangeSlider); } |
Output

Please find thise sample link for your reference.