Hi,
I have an issue using databinding with the MinValue/MaxValue of the XamNumericSlider. In my actual application I try to bind the MaxValue property while setting the MinValue to 0. However, the MinValue ends up being set to -1. I guessed that this had something to do with the MaxValue being bound to the value 0 (i.e. the same as the MinValue) and tried to use a binding for the MinValue as well. However, even though MaxValue is set correctly by the binding to whatever positive number, the slider's MinValue is stuck at -1.
I have attached a sample application that show the issue. The application sets the MinValue/MaxValue based on databinding, with both source values set to 0. This results in the actual slider MinValue being set to -1. If I then use the 'Increment MaxValue by 1' button to set the MaxValue to a value of at least 1, and then use the 'Set MinValue to MaxValue - 1' button to try to set the MinValue, the slider's MinValue is stuck at -1.
The sample application has a '#define MAX_IT_WORK' directive that can be used to set the initial source MaxValue to 1 rather than 0. In this case, the sample application works as expected, i.e. the MinValue is updated correctly using the button. However, my actual application does still seem to have the issue if I make sure that the MaxValue source is always bigger than 0.
How can I get my bindings to work?
Regards,Leif
Hi Leif,
I am just checking, if you require any further assistance on this matter.
Hi Lief,
I received a reply from our development team and the decrementing of the MinValue when it is set to be the same as the MaxValue is the design behavior of the XamNumericSlider. The desired by you behavior has been determined to be a new product idea. You can suggest new product ideas for future versions (or vote for existing ones) at <http://ideas.infragistics.com>.
There are many benefits to submitting an product idea:
- Direct communication with our product management team regarding your product idea.
- Notifications whenever new information regarding your idea becomes available.
- Ability to vote on your favorite product ideas to let us know which ones are the most important to you. You will have ten votes for this and can change which ideas you are voting for at any time.
- Allow you to shape the future of our products by requesting new controls and products altogether.
- You and other developers can discuss existing product ideas with members of our Product Management team.
Steps to create your idea:
1. Log into the Infragistics Product Idea site at http://ideas.infragistics.com (creating a new login if needed).
2. Navigate to the product / platform channel of your choice (e.g. WPF, Windows Forms, ASP.NET, HTML5 / Ignite UI, iOS / NucliOS, etc.)
3. Add your product idea and be sure to be specific and provide as much detail as possible. Explain the context in which a feature would be used, why it is needed, why it can’t be accomplished today, and who would benefit from it. You can even add screenshots to build a stronger case. Remember that for your suggestion to be successful, you need other members of the community to vote for it. Be convincing!
The Product Idea site puts you in the driver’s seat and allows you to track the progress of your ideas at any time, see how many votes it got, read comments from other developers in the community, and see if someone from the product team has additional questions for you.
Hello Lief,
I have logged this behavior with our developers in our tracking system, with an issue ID of 174045. I have also created a support ticket on your behalf with number CAS-138895-K1N4G8 in order to link the development issue to it so that you are automatically updated when a Service Release containing your fix is available for download.
setting the bindings to TwoWay made my code work, but at the cost of adding unneeded code to my View Model: The values for the min/max properties were originally read-only as they are generated by model code. Using a two-way binding made me make dummy setters for these properties, which isn't pretty.
I still find it strange that my main application's MinValue is set to -1, since my bound MaxValue value is always greater than 0 (i.e.always greater than the MinValue). Something in the slider control or the binding framework must obviously set the MaxValue to 0 without being told so by my code.
Also, is it really logically correct for the slider to not allow equal values for MinValue, MaxValue and Value? This sounds like a perfectly valid case to me, i.e. one single allowed value. Setting the MaxValue to less than the MinValue is of course logically wrong though.
Thank you for your post. I have been looking into your question and after investigating this behavior I found out that when the ‘MinValue’, ‘MaxValue’ and ‘Value’ properties has the same value, the XamNumericEditor sets the MinValue on the MaxValue – 1 because they cannot be equal(logically this is not correct). This is the design behavior of the control.
Regarding your issue with the ‘Set MinValue to MaxValue - 1’ button you need to bind the ‘MinValue’ and ‘MaxValue’ properties with Mode set to “TwoWay” in order to notify the change like e.g.:
MinValue="{Binding Min, Mode=TwoWay}"
MaxValue="{Binding Max, Mode=TwoWay}"
Please let me know, if you need any further assistance on this matter.