Bug 31970 - Construction/initialisation of Slider throws exception or ignores values on Windows
Summary: Construction/initialisation of Slider throws exception or ignores values on W...
Status: RESOLVED DUPLICATE of bug 50783
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 1.4.4
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-07-15 10:43 UTC by John Hardman
Modified: 2017-01-10 22:19 UTC (History)
5 users (show)

Tags: windows
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 John Hardman 2015-07-15 10:43:55 UTC
The code below is a slightly modified version of the SliderDemoPage from the Forms Gallery sample. I have included two ways of creating/initialising a Slider, the first of which is commented out.

With the first commented out, the following throws an exception.
With the second commented out, the default value is not applied to the Slider.
Both methods should work. Neither does.

(May be related to bug #23665)

using System;
using Xamarin.Forms;

namespace FormsGallery
    class SliderDemoPage : ContentPage
        Label label;

        public SliderDemoPage()
            Label header = new Label
                Text = "Slider",
				FontSize = 50,
				FontAttributes = FontAttributes.Bold,
                HorizontalOptions = LayoutOptions.Center

            // On Windows, this results in the Slider having value = 1
            //Slider slider = new Slider(1, 100, 50)
            //    VerticalOptions = LayoutOptions.CenterAndExpand

            // On Windows, this results in the following System.ArgumentException
            //System.ArgumentException was unhandled by user code
            //  HResult=-2147024809
            //  Message=Value was an invalid value for Minimum
            //Parameter name: value
            //  Source=Xamarin.Forms.Core
            //  ParamName=value
            //  StackTrace:
            //       at Xamarin.Forms.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes)
            //       at Xamarin.Forms.BindableObject.SetValue(BindableProperty property, Object value, Boolean fromStyle, Boolean checkAccess)
            //       at Xamarin.Forms.BindableObject.SetValue(BindableProperty property, Object value)
            //       at Xamarin.Forms.Slider.set_Minimum(Double value)
            //       at FormsGallery.SliderDemoPage..ctor()
            //  InnerException: 
            Slider slider = new Slider
                Minimum = 1,
                Maximum = 100,
                Value = 50,
                VerticalOptions = LayoutOptions.CenterAndExpand
            slider.ValueChanged += OnSliderValueChanged;

            label = new Label
                Text = "Slider value is 0",
				FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.CenterAndExpand

            // Build the page.
            this.Content = new StackLayout
                Children = 

        void OnSliderValueChanged(object sender, ValueChangedEventArgs e)
            label.Text = String.Format("Slider value is {0:F1}", e.NewValue);
Comment 1 John Hardman 2015-07-15 11:04:32 UTC
I suspect also that the setter for the Minimum property is also setting the Value property.
Comment 2 Paul DiPietro [MSFT] 2015-08-24 13:44:29 UTC
There's possibly something more to this here which will require extra investigation. I'm noting odd behavior on Android as well where it appears that setting a value to something such as -2 will cause the slider to start at -0.1, and setting the Value explicitly (alongside the minimum at -2) will set the baseline to 0. This is while running
Comment 3 Andreas 2016-12-21 11:10:43 UTC
Anyone working with this one?
Comment 4 Jimmy [MSFT] 2017-01-10 22:18:35 UTC
There are two issues in this report and I am still able to reproduce both issues with Forms 2.3.3:

1. Setting the Minimum throws a System.ArgumentException
2. The initial set value is ignored on Windows

However the first issue is not specific to Windows and is occurring on all the platforms. There are two other bugs opened for this issue, bug #47805 and bug #43435. There is also another report filed for the second issue, bug #50783. 

So for the purposes of clarity and organization I am closing this report in favor of the reports mentioned above for the individual issues.

*** This bug has been marked as a duplicate of bug 50783 ***