Slider SelectionStart SelectionEnd order bug

I think I may have found a bug in the slider control. We're binding the SelectionStart and SelectionEnd properties to a model class in our DBML. The properties, let's call them "A" and "B" are in order, and correspond to the start and end in the slider. When we bind the control to a new instance of that class, "A" gets bound first, then "B". I have no control over the order.

The problem is, when your control receives the first binding update (for "A"), it's can't be greater than "B", so it remains at zero. "B" then gets updated just fine.

The end result is that the selection start always ends up being 0.

Is there a workaround? We've gone so far as to re-order the order of the DBML properties, but we're using WCF RIA, and the client side proxy is ordered alphabetically.

Kiril Stanoev

With which version are you testing the project. We made some improvements to RadSlider and this issue might not be present anymore. Could you please download the latest internal build and test your application.

Sincerely yours,
Kiril Stanoev
the Telerik team

Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items

We spent over $4,000 on these controls. I would appreciate it if you can see if it's still an issue, and if not, investigate WHICH version fixes it. We're about to release, and we need good information so that we can make an informed decision about what to do.

Kiril Stanoev

First of all, I'd like to apologize for the ambiguous answer.
Internally, RadSlider makes coercion in the Loaded event handler of its SelectionStart and SelectionEnd properties.

For example, imagine you create a RadSlider in code-behind:

publicMainPage()

{

InitializeComponent();

RadSlider slider1 = newRadSlider();

slider1.Minimum = 0;

slider1.Maximum = 100;

slider1.IsSelectionRangeEnabled = true;

slider1.SelectionStart = 40;

slider1.SelectionEnd = 60;

this.LayoutRoot.Children.Add(slider1);

}

No matter that SelectionStart is set before SelectionEnd, such definition is valid since the slider is not loaded yet and its internal coerce mechanism have not yet passed.

I assume that in your scenario, the slider is loaded and it is waiting for the WCF service to return values for SelectionStart and SelectionEnd. If SelectionStart arrives with a value (ex. 40) greater than SelectionEnd (ex. 10), SelectionStart will get set to 10 since it cannot be greater than SelectionEnd.
One possible workaround is to set SelectionStart to be equal to the slider's Minimum and SelectionEnd to be equal to Maximum. This way, when SelectionStart arrives it will always be less than SelectionEnd and vice versa.

Another way is to create a helper class that will stand between the WCF service and the slider:

If you examine this class, you will see that when SelectionStart arrives and it is greater than SelectionEnd, the new SelectionStart value is kept in a variable and a flag is lifted. When SelectionEnd is set, the helper class checks if the flag is lifter and if it is lifted, it sets SelectionStart to the previously requested value.
In the attached project, I've simulated a scenario where initially SelectionStart and SelectionEnd are 0.0.
With a click of a button, a WCF service is called. I've made sure that SelectionEnd arrives after SelectionStart. With the help of the above class everything worked as expected.
I am attaching my test project for further reference. Have a look at it and let me know if it works for you.

Finally, I've discussed this scenario with my team and during Q3 2010 we will be working on implementing a functionality that will allow you do turn off the coerce mechanism and control SelectionStart and SelectionEnd yourself.

Greetings,
Kiril Stanoev
the Telerik team

Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items

There are two sliders bound to the same data model. The only difference is the order of binding SelectionStart and SelectionEnd. When the page is initially databound, the first slider has SelectionStart allways on zero, no matter what Start value in the model is. The second slider works as expected. I understand the coerce mechanism but it cause an inconsistency between slider and the model.
I'm glad that it will be possible to switch off the coerce mechanism in Q3 version. When you will be modifying the control, you may consider this scenario.

I have already resolved my problem thanks to this forum thread, so this is just an idea for future release.

Regards
Tomas Celeda

Miro Miroslavov

Thank you for your suggestion. You are 100% correct that the order of setting properties in XAML shouldn't matter. I've created work item for this and will be considered for future implementation.
Thank you once again.

Kind regards,
Miro Miroslavov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.