locked
Invalid value for slider minimum RRS feed

  • Question

  • User3516 posted

    Hello,

    i'm trying to set a minimum value for a slider: Slider slider = new Slider { Minimum = 30.0, Maximum = 60.0, Value = 45.0 };

    This results in an exception:

    System.ArgumentException: Value was an invalid value for Minimum
    
    Parameter name: value
    

    I can set the minimum without problems to zero or a negative value, but a value greater than zero throws the error.

    Is this working as intended or a bug?

    Regards, Dirk

    Tuesday, June 24, 2014 1:47 PM

All replies

  • User1004 posted

    set the Maximum first to prevent validation (in this case)

    Tuesday, June 24, 2014 2:46 PM
  • User65389 posted

    @StephaneDelcroix:
    I had the same problem: set maximum before minimum solved it (for me a buuug).
    Thanks :-)

    Tuesday, October 7, 2014 1:34 PM
  • User74160 posted

    The same applies when working in XAML: specify Maximum before Minimum in the tag. See https://bugzilla.xamarin.com/showbug.cgi?id=21181 and https://bugzilla.xamarin.com/showbug.cgi?id=23665.

    Friday, March 6, 2015 10:46 PM
  • User151333 posted

    Set max value than min value. problem solved ;)

    Thursday, October 13, 2016 12:52 PM
  • User232295 posted

    Worked for me too. Thanks guys!

    Thursday, December 1, 2016 10:22 PM
  • User148199 posted

    Unbelievably.

    Monday, December 19, 2016 2:26 PM
  • User247328 posted

    Thanks.

    Still there! Also make sure you set Minimum before you set Value

    Wednesday, March 15, 2017 10:08 AM
  • User240901 posted

    Any update on this? Seems like it would be breaking more applications! The "workaround" practically prevents binding in XAML directly :neutral:

    Maximum="{Binding MaximumZoom}" Minimum="{Binding MinimumZoom}" Value="{Binding CurrentZoom}" ^-- Doesnt work

    Not to mention that setting a binding in cs also returns the wrong value on UWP at least.

    Adding to constructor: zoomSlider.Maximum = 300; zoomSlider.Minimum = 50; zoomSlider.SetBinding(Slider.ValueProperty, "CurrentZoom");

    ^-- Slider value will be 50 on launch.

    Tuesday, April 25, 2017 8:24 AM
  • User256966 posted

    +1 for that.

    Lost at least 5 maybe 10 minutes of work on this bug! :#

    Wednesday, May 3, 2017 10:23 AM
  • User316140 posted

    +1

    Friday, May 12, 2017 2:52 PM
  • User317811 posted

    +1 Thanks for that. Saved me a headache :)

    Friday, June 16, 2017 5:30 PM
  • User348592 posted

    Works for me

    Friday, September 29, 2017 3:34 PM
  • User32322 posted

    This is ridiculous bug. +1 for you guyss, I would never guess that.

    Saturday, November 4, 2017 6:03 PM
  • User173776 posted

    I stumbled on a similar problem. When binding to a slider (value, max, min in that order), the value would first be set to 1, then to minimum. I changed the order or the bindings to max, min, value and it works. This is the first time I've come across a case where the order of xaml attributes matter - this needs to be fixed

    Wednesday, November 29, 2017 3:20 PM
  • User299957 posted

    +1

    Saturday, December 30, 2017 4:10 PM
  • User63735 posted

    Cool feature Xamarin.... not!

    Tuesday, February 6, 2018 6:30 AM
  • User375518 posted

    I have encountered the same problem, no one hurries to fix the bug: D

    Thursday, August 23, 2018 9:32 AM
  • User244409 posted

    Same problem, Max-min-Value order works, but not ever.....binding Minimun doesn't work (always get 0 from slider minimun value), if in xaml i set fixed minimun value works, maximun and value works with binding.
    Ohhh yeahh!!!!! :o

    Wednesday, December 12, 2018 3:39 PM
  • User93655 posted

    We are lucky on this that Maximum comes before Minimum and Value is the last one (A-Z) otherwise Xaml Styler would have sort those properties and introduce a bug each time I save a file :D

    Wednesday, December 12, 2018 3:50 PM
  • User385166 posted

    System.ArgumentException: 'Value is an invalid value for Maximum Parameter name: value'

    Stepper HorizontalOptions="FillAndExpand" Value="{Binding Tedad}" Minimum="0" Maximum="{Binding MaxSelect}" Increment="1">

    Thursday, January 9, 2020 11:40 PM
  • User395199 posted

    +1

    Friday, August 28, 2020 2:40 AM