I'm creating a XamNumericRangeSlider in code behind.
I'm then adding a min SliderTickMarks, and max SliderTickMarks.
I'm then adding a min XamSliderNumericThumb, and max XamSliderNumericThumb.
When displayed I move the min and max thumbs, and I don't get the precision I'm looking for.
Originally I set the min thumb at 0.0, and max thumb at 10.0. I move the thumbs, and the thumb increments are random. I move the max thumb a bit, the value changes to 10.36, and further move it, and value changes to 10.73.
I would like the increments to be in 0.01. How can I achieve this please.
Here is my code...
// Create xam range slider
XamNumericRangeSlider rangeSlider = new XamNumericRangeSlider();
rangeSlider.Name = "nrsSlider";
rangeSlider.ThumbValueChanged += new EventHandler<ThumbValueChangedEventArgs<double>>(rangeSlider_ThumbValueChanged);
rangeSlider.IsSelectionRangeEnabled = true;
rangeSlider.TrackClickAction = SliderTrackClickAction.MoveToPoint;
rangeSlider.IsMouseWheelEnabled = true;
rangeSlider.MinValue = 0.0;
rangeSlider.FontSize = 8;
rangeSlider.MaxValue = 100.0;
rangeSlider.Margin = new Thickness(5, 5, 5, 5);
rangeSlider.IncreaseButtonVisibility = System.Windows.Visibility.Collapsed;
rangeSlider.DecreaseButtonVisibility = System.Windows.Visibility.Collapsed;
// Create min tick mark for slider
SliderTickMarks minTickMark = new SliderTickMarks();
minTickMark.TickMarksFrequency = 5.0;
minTickMark.IncludeSliderEnds = true;
minTickMark.UseFrequency = true;
rangeSlider.TickMarks.Add(minTickMark);
// Create max tick mark for slider
SliderTickMarks maxTickMark = new SliderTickMarks();
maxTickMark.TickMarksFrequency = 10.0;
maxTickMark.IncludeSliderEnds = true;
maxTickMark.UseFrequency = true;
DataTemplate maxTickDisplay = (DataTemplate)FindResource("HorizontalTick");
maxTickMark.HorizontalTickMarksTemplate = maxTickDisplay;
rangeSlider.TickMarks.Add(maxTickMark);
// Add min thumb to slider
XamSliderNumericThumb minThumb = new XamSliderNumericThumb();
minThumb.Name = "sliderMin";
minThumb.InteractionMode = SliderThumbInteractionMode.Push;
minThumb.IsSnapToTickEnabled = false;
minThumb.Value = 0.0;
minThumb.TrackFillBrush = new SolidColorBrush(Colors.Transparent);
rangeSlider.Thumbs.Add(minThumb);
// Add max thumb to slider
XamSliderNumericThumb maxThumb = new XamSliderNumericThumb();
maxThumb.Name = "sliderMax";
maxThumb.InteractionMode = SliderThumbInteractionMode.Push;
maxThumb.IsSnapToTickEnabled = false;
maxThumb.Value = 10.0;
rangeSlider.Thumbs.Add(maxThumb);
Hello cxradhak,
There is no exposed way to set the precision on Slider controls, but if you set SmallChange = 0.1 and LargeChange = 0.1 , it will be possible to move the thumbs with 0.1 every time when you are clicking over the TrackFill or when you are using the Increase/Decrease buttons. Is that helping you in some way?
Regards,
Nikola.
Kindly help
Infragistics gurus...kindly help.