We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

RangeSliderControl databinding not working

Thread ID:

Created:

Updated:

Platform:

Replies:

104630 Aug 3,2012 02:25 PM UTC Aug 14,2012 07:00 AM UTC WPF 1
loading
Tags: Tools
Administrator [Syncfusion]
Asked On August 3, 2012 02:25 PM UTC

Hi,

I want to bind a RangeSliderControl Value or Range to the datacontext and it doesn't seem to work and I can't find an example in the online docs.  In the attached example, I have a simple model with 2 properties, a double and a DoubleRange.  Then I have a label, a traditional Microsoft Slider, a RangeSliderControl bound to the double in my model, and a RangeSliderControl bound to the DoubleRange in my model.  The label and slider work as expected, but the RangeSliderControls don't participate in the binding and there are no binding errors in the output window.

Any ideas?

--Jonathan

Here is my XAML for the 4 databound controls:

 <StackPanel>
        <Label Content="{Binding Path=SliderValue}" Height="28" />
        <Slider Value="{Binding Path=SliderValue}" Width="100" />
        <syncfusion:RangeSliderControl Height="100" Maximum="10" TickFrequency="1" Value="{Binding Path=SliderValue}"></syncfusion:RangeSliderControl>
        <syncfusion:RangeSliderControl Height="100" Maximum="10" TickFrequency="1" Range="{Binding Path=SliderRange}"></syncfusion:RangeSliderControl>
    </StackPanel>

And the code for my model:

class Model : INotifyPropertyChanged
    {
        private double sliderValue;

        public double SliderValue
        {
            get { return sliderValue; }
            set
            {
                sliderValue = value;
                Change("SliderValue");
            }
        }

        public DoubleRange SliderRange
        {
            get
            {
                return new DoubleRange(0, SliderValue);
            }

            set
            {
                SliderValue = value.End;
                Change("SliderRange");
            }
        }

        #region INotitifyPropertyChanged

        public event PropertyChangedEventHandler PropertyChanged;

        protected void Change(string field)
        {
            var pc = PropertyChanged;
            if (pc != null)
            {
                pc.Invoke(this, new PropertyChangedEventArgs(field));
            }
        }

        #endregion


Muthalagu M [Syncfusion]
Replied On August 14, 2012 07:00 AM UTC

Hi Jonathan,

Sorry for the delay in getting back to you.

Thanks for using Syncfusion Products.

We have prepared a sample for RangeSlider Control with DataBinding and we have attached the sample.Please find this.

In this sample, we have acheived this DataBinding with RangeSlider in following way.

We have used RangeVisibiltiy property and it is set to False for binding the SliderValue.

Also we have made changes in SliderRange property to bind the values correctly.

Please let us know in case of any queries.

Regards,

Muthalagu



RangeSliderControlDataBinding104630Demo_1966854a.zip

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;