Hi,
I've configured a slider in order to select a value between ZERO and ONE which can have maximum 2-digit after ZERO. I've attached a sample project and a video in order to explain my problems:
1. I didn't change the original thumb style but still the ticks and the thumb's arrow doesn't align correctly. There is a slight difference. May be it's because of my tick configuration. Can you check it out?
2. Second problem is a weird one: As you can see in the video I bind a TextBox to the thumbs Value property in order to show the current value. But after 0.8 it starts to show values like 0.8400000000000001.
Can you check out the sample project? May be my configurations are wrong.
Thanks in advance
Hello,
Our development team investigate this issue and found that the precision in .NET for double numbers is the reason to see such values. As solution I can suggest you to use rounding to overcome this issue.
Let me know if you have any further questions.
Sincerely,DimiDeveloper Support EngineerInfragistics, Inc.
The incorrect precision of the value issue is logged with reference number 37054 in case anyone else encounters this.
Thanks for the reply!
Your solution for the first issue worked. Thanks.
For the second issue, I also formatted the value in TextBlock but I wanted to inform you about the problem.
Thanks again
I apologize that your post has not been answered by an Infragistics employee.
Regarding issue 1 :
What you can do is set the RenderTransform property on the Thumb and adjust it so that it aligns with tickmark. I believe the slider is using the left side of the thumb and the left side of the tickmark to determine the current value of the slider.
<ig:XamSliderNumericThumb ...>
<ig:XamSliderNumericThumb.RenderTransform>
<TranslateTransform X="-3"/>
</ig:XamSliderNumericThumb.RenderTransform>
</ig:XamSliderNumericThumb>
Regarding issue 2 : I am not sure if we should be rounding up the value but it is strange that it changes after a specific value. We will take a look at this as a potential issue. What you could do is to set the StringFormat property of the binding of the TextBlock, like so :
Text="{Binding ElementName=sliderThumbValue, Path=Value,StringFormat=###.##}"
I'm still waiting :(