Bug 43429 - Slider with minimum greater than 0 gets incorrect bound value on Android
Summary: Slider with minimum greater than 0 gets incorrect bound value on Android
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.1
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-08-16 18:32 UTC by E.Z. Hart [MSFT]
Modified: 2017-02-03 17:24 UTC (History)
4 users (show)

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

Repro project (279.26 KB, application/x-zip-compressed)
2016-08-16 18:32 UTC, E.Z. Hart [MSFT]

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 E.Z. Hart [MSFT] 2016-08-16 18:32:22 UTC
Created attachment 17055 [details]
Repro project

On Android, a slider with its Value property databound gets the incorrect value if the Minimum property is set to a value greater than zero. If the Minimum property is set to zero, the databinding works as expected.

To reproduce:
Run the attached project on Android. The top Slider has a Maximum value of 10 and a Minimum value of 1; the view model has the value set to 5. The Label above the Sliders is also bound to the value from the ViewModel - instead of displaying 5 as expected, it displays 4.996.

The bottom Slide is bound to the same value but has a Minimum of zero - the Slider appears to display the correct value (halfway).
Comment 1 adrianknight89 2016-09-25 03:56:31 UTC
The problem is Control.Progress is an int in the renderer. As the slider moves, progress will only show int values. This results in precision loss when Value is being calculated.
Comment 2 adrianknight89 2016-09-25 04:46:02 UTC
See https://github.com/xamarin/Xamarin.Forms/pull/378
Comment 3 Rui Marinho 2016-12-19 12:46:42 UTC
Should be fixed in 2.3.4-pre2
Comment 4 Parmendra Kumar 2017-02-03 17:24:45 UTC
I have checked this issue with Xamarin.Forms and observed that this issue as been fixed with Android hence marked this issue as Verified Fixed.
But I am still getting issue with WindowsPhone/UWP so I have filed separate issue for the same.
Bug: https://bugzilla.xamarin.com/show_bug.cgi?id=52292