So I have a Stacklayout and a slider inside it with a label below showing the value selected like so:
StackLayout optionLayout = new StackLayout()
{
Padding = new Thickness(15, 0),
};
Slider slider = new Slider();
slider.SetBinding(Slider.MaximumProperty, new Binding("MaxRating", BindingMode.OneWay));
slider.SetBinding(Slider.ValueProperty, new Binding("Rating", BindingMode.TwoWay));
Label sliderVal = new Label();
sliderVal.Text = slider.Value.ToString();
slider.ValueChanged += ((s, a) =>
{
sliderVal.Text = slider.Value.ToString();
var newStep = Math.Round(a.NewValue / 1);
slider.Value = newStep * 1;
});
optionLayout.Children.Add(slider);
optionLayout.Children.Add(sliderVal);
The value is rounded to the nearest int. but I can only select a value by clicking somewhere on the slider. In this case 1,2,3,4,5. I cannot slide the slider up values. On Windows phone I can slide the slider up the scale to select the next value. But on android I can't. I've tried commenting out ValueChanged and it doesn't make a difference. Was wondering whether this was the correct behavior from my slider?