Bug 54887 - Slider's "ValueChanged" event doesn't raise during firstly position changing in XF Android
Summary: Slider's "ValueChanged" event doesn't raise during firstly position changing ...
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.3.4
Hardware: PC Windows
: Normal major
Target Milestone: ---
Assignee: Chris King
Depends on:
Reported: 2017-04-09 13:19 UTC by Sergii Vasyliev
Modified: 2018-02-09 10:24 UTC (History)
14 users (show)

Tags: slider ac fr
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Sergii Vasyliev 2017-04-09 13:19:13 UTC
# Steps to reproduce
1) install XF nuget package. 
2) XAML content is:
        <Slider x:Name="TestSlider">

3) Code:
    public partial class BaseEditPresetView : ContentView
        public BaseEditPresetView()
            TestSlider.ValueChanged += TestSlider_ValueChanged;
        private void TestSlider_ValueChanged(object sender, ValueChangedEventArgs e)
            //Set breakpoint here
4) Set breakpoint in TestSlider_ValueChanged method 
5) Run app and change Slider's position from UI

# Expected behavior
TestSlider_ValueChanged event should be raised

# Actual behavior
TestSlider_ValueChanged doesn't raise at first time, but it works for second time and further

# Test environment (full version information)
Bug in XF It was tested with few Android devices and VS android emulator
It works as expected with XF
Comment 1 Paul DiPietro [MSFT] 2017-04-10 14:57:59 UTC
This appears to only be occurring on Android.
Comment 3 Chris King 2017-04-19 16:37:34 UTC
I'm unable to reproduce this on the version in the reproduction or on the latest master. The event is raised as soon as I start sliding the slider.
Comment 4 Jean-Daniel Gasser 2017-04-27 05:32:42 UTC
I also noticed the same bug.

Please see my question on Xamarin Forum:

I'm not alone to see this behavior.
Comment 5 Sergii Vasyliev 2017-04-27 08:42:54 UTC
I've updated nuget XF to - it seems now slider works correct, and event fires at first time as expected. 
Have anything been changed in XF ?
Comment 6 Jean-Daniel Gasser 2017-04-27 09:03:50 UTC
By my side it won't work, even with

Please be sure to try to just "tap" once the slider in the middle of it, you will see the cursor change its position on the screen, but the vent is not fired.
Please do not "slide" the cursor, but just "tap" it.

I tried in a new Xamarin Forms project with version, then upgraded packages to, but the bug still remains
Comment 7 Sergii Vasyliev 2017-05-04 08:04:15 UTC
I worked few days with my laptop (XF verion in laptop is, where this bug exists. Then I pulled changes from my laptop to my PC, and now the bug occurs again (my current version of XF on PC was Even reverse back to previous commit didn't help, although all worked before.
Then I installed XF on my PC - this resolved problem, the bug disappeared.
Then I tried to upgrade XF to latest version again - and the bug occurs again. So in my case this bug depends from version of XF (latest stable version is, although I don't understand why I had working project with before pulling changes from laptop
Comment 8 philip 2017-05-28 14:34:08 UTC
still happening for me as well
Comment 9 Chris King 2017-06-20 17:22:42 UTC
Confirmed. If you just tap on the slider the event is not fired. If you slide it the event is fired.
Comment 10 Chris King 2017-06-23 20:55:40 UTC
Having a hell of a time getting the debugger to work on this reproduction...
Comment 11 Chris King 2017-06-23 21:37:23 UTC
Reported debugging issues: https://bugzilla.xamarin.com/show_bug.cgi?id=57729
Comment 12 Jeff Dalby 2017-07-26 16:36:10 UTC
We also have the same issue, only with tapping the slider. Still occurs in the 2.3.5.x code (which makes sense given it hasn't been fixed yet).
Comment 13 Jeff Dalby 2017-07-26 16:38:12 UTC
I should add, we aren't using the value_changed event, we just have the value bound to the view model and it isn't getting updated (which I assume updates based on the value_changed event firing).
Comment 14 Jeff Dalby 2017-08-23 19:23:26 UTC
Any way to bump up the priority on this?  Our app is used in mental health care for people to track emotional state.  Half the inputs are based on the slider, and this defect makes it so we can't update past  The latest still has the issue.
Comment 15 Jeff Dalby 2017-08-23 20:30:58 UTC
Looking at the code changes here

My guess is this check:
void SeekBar.IOnSeekBarChangeListener.OnProgressChanged(SeekBar seekBar, int progress, bool fromUser)
			if (!_progressChangedOnce)
				_progressChangedOnce = true;

Is making it so the first tap is ignored.  We did some testing and if you tap a second time it works.
Comment 16 MK 2017-10-03 11:56:42 UTC
Thanks for the pointer Jeff! Following on from your suggestion I tried creating my own renderer, copy-pasting the xamarin code from github, then simply commented out the whole part:

if (!_progressChangedOnce) {
                _progressChangedOnce = true;

Have only tested very briefly but seems to work fine for me, including the original bug which that commit claims to fix... tbh I'm not sure what that addition was good for anyway?
Comment 17 Dr. T 2017-11-11 17:52:55 UTC
I workaround this bug by setting slider's value to 1 at startup time, then wait for 1 millisecond before reset the value to 0.

slider.Value = 1;
Device.StartTimer(TimeSpan.FromMilliseconds(1), () => {
   slider.Value = 0;
   return false;
Comment 18 Jeff Dalby 2017-11-13 23:46:00 UTC
Hi, so first, what needs to be done to actually get this fixed?  There's been no response from Chris King in months. I found the fix nearly two months ago, and it's stopping me from being able to get any other fixes in newer releases.  On top of that it literally breaks every app that uses the sliders on Android.  You'd think that would make this an important thing to fix.  All that needs to happen is someone needs to comment out five lines.

Next, MK, if you happen to see this how were you able to create your own custom renderer?  When I attempt to do so I can't because in the section:
protected override SeekBar CreateNativeControl()
			return new FormsSeekBar(Context);

FormsSeekerBar is marked as internal.

Dr.T, that is such an impractical workaround, and yet thanks for sharing. It looks like the route I may have to go...which is ridiculous.
Comment 19 MK 2017-11-14 05:19:23 UTC
Hi Jeff,
yes you are right I also copied the code for the class FormsSeekBar from the Xamarin github (in the namespace Xamarin.Forms.Platform.Android). So the copied code hides the internal implementation of FormsSeekBar and my slider custom renderer code uses my class FormsSeekBar rather than the true internal one, but with identical code.
Of course this is all quite ugly and means I will not get any fixes Xamarin make to FormsSeekBar unless I actively copy their new code... but at least my app is working for the moment and of course we're all hoping Xamarin will eventually solve the underlying issue, getting rid of the need for the custom renderer entirely.
Comment 20 Samantha Houts [MSFT] 2018-02-01 18:31:25 UTC
Comment 21 Rui Marinho 2018-02-09 10:24:29 UTC
Should be fixed on 2.6.0-pre1