This is a migrated thread and some comments may be shown as answers.

Binding SelectionStart and SelectionEnd not working

6 Answers 127 Views
Slider
This is a migrated thread and some comments may be shown as answers.
Tolga
Top achievements
Rank 1
Tolga asked on 29 Oct 2010, 01:39 AM
Hello:

I am trying to build a generic slider control using RadSlider for Silverlight using MVVM. I am able to successfully bind the Maximum and Minimum values. However, SelectionStart and SelectionEnd I am just not able to get it to work using data binding. Am I missing something?
Here is some code...

ViewModel

public

 

 

class MainViewModel : ViewModelBase

 

{

 

 

//keys

 

 

 

private Double _maximumNumberOfKeys;

 

 

 

public Double MaximumNumberOfKeys

 

{

 

 

get

 

{

 

 

return _maximumNumberOfKeys;

 

}

 

 

set

 

{

_maximumNumberOfKeys =

 

value;

 

OnPropertyChanged(

 

"MaximumNumberOfKeys");

 

}

}

 

 

private Double _selectedMaxNumberOfKeys;

 

 

 

public Double SelectedMaxNumberOfKeys

 

{

 

 

get

 

{

 

 

return _selectedMaxNumberOfKeys;

 

}

 

 

set

 

{

_selectedMaxNumberOfKeys =

 

value;

 

OnPropertyChanged(

 

"SelectedMaxNumberOfKeys");

 

}

}

 

 

public MainViewModel()

 

{

 

 

this.MaximumNumberOfKeys = 200;

 

 

 

this.SelectedMaxNumberOfKeys = 200;

 

OnPropertyChanged(

 

"MaximumNumberOfKeys");

 

OnPropertyChanged(

 

"SelectedMaxNumberOfKeys");

 

}

 

}

UI

 

<

 

 

telerik:RadSlider Minimum="0"

 

 

 

 

 

 

 

Maximum="{Binding MaximumNumberOfKeys}"

 

 

 

 

 

 

 

SelectionStart="0"

 

 

 

 

 

 

 

SelectionEnd="{Binding SelectedMaxNumberOfKeys}"

 

 

 

 

 

 

 

MinimumRangeSpan="0"

 

 

 

 

 

 

 

MaximumRangeSpan="{Binding MaximumNumberOfKeys}"

 

 

 

 

 

 

 

IsSelectionRangeEnabled="True"

 

 

 

 

 

 

 

TickPlacement="TopLeft" />

 

 

 

 

Thanks

--tolga

6 Answers, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 01 Nov 2010, 12:59 PM
Hi Tolga,

I believe this issue has been fixed with our Beta release, so could you please download the Beta binaries  -2010.3.1018.1040 and test your project with them. If this is not an option, we have a Q3 release which is scheduled for the middle of this month.

Let me know how I can be of further assistance.

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
0
Trude
Top achievements
Rank 2
answered on 07 Feb 2011, 06:16 PM
I too have problems with binding SelectionStart and SelectionEnd. I'm using the official Q3 SP1 release:

<telerik:RadSlider TickFrequency="0.1" TickPlacement="BottomRight" IsSelectionRangeEnabled="True" Minimum="0" Maximum="1" MaximumRangeSpan="1" MinimumRangeSpan="0" SelectionEnd="{Binding value_rating_max, Mode=TwoWay}" SelectionStart="{Binding value_rating_min, Mode=TwoWay}"/>

In code-behind I create a new item with value_rating_max = 0.6 and value_rating_min = 0.4 and bind it to the slider (DataContext). When the slider is created/initiated the first time SelectionStart is reset to 0 and SelectionEnd is set to 0.4.

If I create an identical item and bind it to the slider everything is OK; something happens after the first binding that makes subsequent bindings work, but I can't figure out what. I've tried switching the order of SelectionStart, SelectionEnd, Minimum and Maximum, but nothing works.
0
Trude
Top achievements
Rank 2
answered on 07 Feb 2011, 06:44 PM
A little update, from the code-behind (setting default values, before binding):
Dim _new_item = New my_data_item
_new_item.value_rating_min = 0.4
_new_item.value_rating_max = 0.6
RadSlider1.DataContext = _new_item

As I said in the previous post the slider resets value_rating_min to 0 and value_rating_max = 0.4 on first time init (subsequent bindinds work).
However, if I change the code-behind to:

Dim _new_item = New my_data_item
_new_item.value_rating_min = 0.41
_new_item.value_rating_max = 0.61
RadSlider1.DataContext = _new_item

Everything works all the time (?!). I don't know what is happening.
0
Petar Mladenov
Telerik team
answered on 09 Feb 2011, 10:06 AM
Hi Jorn,

This appears to be a Bug in the RadSlider. We logged it in our PITS (Slider: In Silverlight, Setting the ViewModel of the Slider with SelectionStart = 0.4, Selection End = 0.6 after InitializeComponent doesn't  work)
where you will be soon able to vote for. We also updated your telerik account points accordingly. Thank you for your cooperation.

Greetings,
Petar Mladenov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Trude
Top achievements
Rank 2
answered on 09 Feb 2011, 10:15 AM
Ok, thanks for recognizing this. Maybe it's related to this PITS item?:

http://www.telerik.com/support/pits.aspx#/public/silverlight/4668
0
Petar Mladenov
Telerik team
answered on 09 Feb 2011, 12:19 PM
Hi Jorn,

Yes, the issues have similar character. We`ll investigate in depth but we cannot promise a release date when the fix will be available. Thank you for your cooperation again.

Greetings,
Petar Mladenov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Tags
Slider
Asked by
Tolga
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Trude
Top achievements
Rank 2
Petar Mladenov
Telerik team
Share this question
or