Forum Xamarin.Forms

Invalid value for slider minimum

DirkWilhelmDirkWilhelm USMember ✭✭✭✭✭


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?



  • FredyWengerFredyWenger CHInsider ✭✭✭✭✭

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

  • curtis.ehrhartcurtis.ehrhart USMember ✭✭

    Worked for me too. Thanks guys!

  • SuatKorkmazSuatKorkmaz USMember ✭✭✭


  • 205205 USMember


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

  • RyanDixonRyanDixon USMember ✭✭✭
    edited April 2017

    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.

  • emilsteenemilsteen SEMember ✭✭

    +1 for that.

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

  • filengafilenga BRMember


  • Garyb99Garyb99 USMember ✭✭

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

  • Works for me

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

  • CatoLommerudCatoLommerud USMember ✭✭

    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

  • biaparbiapar ITMember ✭✭✭


  • BenjaminPettitBenjaminPettit USMember ✭✭

    Cool feature Xamarin.... not!

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

  • DavidCasoVazquezDavidCasoVazquez ESMember ✭✭
    edited December 2018

    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

  • NicolasKrierNicolasKrier FRMember ✭✭✭

    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

  • fakhravarifakhravari Member ✭✭✭✭
    edited January 2020

    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"></Stepper

  • iboconibocon Member ✭✭


Sign In or Register to comment.