Binding SelectionStart and SelectionEnd not working

8 posts, 0 answers
  1. Tolga
    Tolga avatar
    28 posts
    Member since:
    Jun 2007

    Posted 28 Oct 2010 Link to this post

    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

  2. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1511 posts

    Posted 01 Nov 2010 Link to this post

    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
  3. DevCraft banner
  4. Jorn
    Jorn avatar
    222 posts
    Member since:
    Jun 2009

    Posted 07 Feb 2011 Link to this post

    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.
  5. Jorn
    Jorn avatar
    222 posts
    Member since:
    Jun 2009

    Posted 07 Feb 2011 Link to this post

    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.
  6. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 09 Feb 2011 Link to this post

    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>>
  7. Jorn
    Jorn avatar
    222 posts
    Member since:
    Jun 2009

    Posted 09 Feb 2011 Link to this post

    Ok, thanks for recognizing this. Maybe it's related to this PITS item?:

    http://www.telerik.com/support/pits.aspx#/public/silverlight/4668
  8. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 09 Feb 2011 Link to this post

    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>>
  9. Roman
    Roman avatar
    1 posts
    Member since:
    Jul 2011

    Posted 28 May 2014 Link to this post

    Has this been fixed? I've encountered a similar issue in WPF and the links above don't seem to lead to an individual bug report, just to the support page.
Back to Top
DevCraft banner