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

Adding items to RadDataBoundListBox based on condition

3 Answers 35 Views
DataBoundListBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Vishesh
Top achievements
Rank 1
Vishesh asked on 13 Jan 2015, 09:09 PM
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!

3 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 16 Jan 2015, 01:28 PM
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.

 
0
Vishesh
Top achievements
Rank 1
answered on 16 Jan 2015, 05:34 PM
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?
 
0
Ves
Telerik team
answered on 21 Jan 2015, 08:06 AM
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.

 
Tags
DataBoundListBox
Asked by
Vishesh
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Vishesh
Top achievements
Rank 1
Ves
Telerik team
Share this question
or