Adding items to RadDataBoundListBox based on condition

4 posts, 0 answers
  1. Vishesh
    Vishesh avatar
    2 posts
    Member since:
    May 2014

    Posted 13 Jan 2015 Link to this post

    I'm using RadDataBoundListBox in my WP8 app.
    - There is a slider control on the page.
    - Listbox is to be populated by List<MyData> (MyData containing a property named "timestamp"). 

    Now when the slider value becomes equal to the timestamp property of any List Item then I need to add that item to the RadDataBoundListBox. How can I do that?

    Could DataTriggerBehaviour be helpful in this case? orCan this be done using normal ListBox control (if not possible using RadDataBoundListBox)? Thanks in advance!
  2. Dimitrina
    Admin
    Dimitrina avatar
    442 posts

    Posted 16 Jan 2015 Link to this post

    Hi Vishesh,

    DataBoundListBox is populated with items through its ItemsSource property. This essentially means that you can only add new items in the component by adding them in the collection set as its ItemsSource. In your case, when the slider reaches a certain value, you can go ahead and add a new object in the collection thus updating the DataBoundListBox items.

    Please let me know if you have any other questions.

    Regards,
    Dimitrina
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. DevCraft banner
  4. Vishesh
    Vishesh avatar
    2 posts
    Member since:
    May 2014

    Posted 16 Jan 2015 in reply to Dimitrina Link to this post

    Thanks @Dimitrina. That was helpful!
    Also, since I need to detect when the slider value becomes equal to the timestamp property of any List Item, so should I do this comparison every time the slider is updated (may involve redundancy) or any other approach could be adopted?
     
  5. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 21 Jan 2015 Link to this post

    Hi Vishesh,

    An alternative approach would be to maintain a sorted list. This will decrease the search time.

    Best regards,
    Ves
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top