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

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


Attachments

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

3) Code:
    public partial class BaseEditPresetView : ContentView
    {
        public BaseEditPresetView()
        {
            InitializeComponent();
            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 2.3.4.224. It was tested with few Android devices and VS android emulator
It works as expected with XF  2.3.3.193
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
Hello,
I also noticed the same bug.

Please see my question on Xamarin Forum:
https://forums.xamarin.com/discussion/comment/269416#Comment_269416

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 2.3.4.231 - it seems now slider works correct, and event fires at first time as expected. 
Have anything been changed in XF 2.3.4.231 ?
Comment 6 Jean-Daniel Gasser 2017-04-27 09:03:50 UTC
Hello,
By my side it won't work, even with 2.3.4.231

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 2.3.4.224, then upgraded packages to 2.3.4.231, 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 2.3.4.231), 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 2.3.4.231). Even reverse back to previous commit didn't help, although all worked before.
Then I installed XF 2.3.3.193 on my PC - this resolved problem, the bug disappeared.
Then I tried to upgrade XF to latest 2.3.4.231 version again - and the bug occurs again. So in my case this bug depends from version of XF (latest stable version is  2.3.3.193), although I don't understand why I had working project with 2.3.4.231 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 2.3.3.193.  The latest 2.4.0.266-pre-1 still has the issue.
Comment 15 Jeff Dalby 2017-08-23 20:30:58 UTC
Looking at the code changes here
https://github.com/xamarin/Xamarin.Forms/commit/e0165abbcd1329a3dfd353548f5d75eef0c792de

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



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;
                return; 
            }


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?

Note You need to log in before you can comment on or make changes to this bug.