This question is locked. New answers and comments are not allowed.
Hi,
since there is no selectedIndex in the RadDataBoundListBox, could you please provide an example to get the index to use with the wp NavigationService.
I know it is somehow possible with "indexOf" but a practical example would help here.
Thanks!
Best regards,
Marcus
since there is no selectedIndex in the RadDataBoundListBox, could you please provide an example to get the index to use with the wp NavigationService.
I know it is somehow possible with "indexOf" but a practical example would help here.
Thanks!
Best regards,
Marcus
8 Answers, 1 is accepted
0
Hi Marcus,
Thank you for your question.
Let's say you have a collection of items of type T called Items and this collection is the ItemsSource for a RadDataBoundListBox called listBox. Then here's how you can use IndexOf to get the index of the selected item:
Let me know if you need further assistance.
Greetings,
Todor
the Telerik team
Thank you for your question.
Let's say you have a collection of items of type T called Items and this collection is the ItemsSource for a RadDataBoundListBox called listBox. Then here's how you can use IndexOf to get the index of the selected item:
int index = this.Items.IndexOf(this.listBox.SelectedItem as T);
Let me know if you need further assistance.
Greetings,
Todor
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Marcus
Top achievements
Rank 2
answered on 30 Jan 2013, 09:04 AM
This one did the trick! Thanks!
0
Daniel
Top achievements
Rank 1
answered on 14 Feb 2013, 06:01 PM
Is there another way to determine the selected index without a reference back to the assigned item collection?
0
Hi Daniel,
Kiril Stanoev
the Telerik team
The other way would be to use RadDataBoundListBox's GetDataSourceItemForDataItem(object dataItem) method. The method returns an object of type IDataSourceItem which has an Index property. Give it a try and let me know how it goes.
Kind regards,Kiril Stanoev
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Delilah
Top achievements
Rank 1
answered on 19 Feb 2013, 02:16 PM
Not to include SelectedIndex... seriously.
0
Hello Delilah,
We will extend the API of the control accordingly.
The lack of a SelectedIndex property is because of some performance considerations we have once when initially developing the concept of the control.
Greetings,
Deyan
the Telerik team
We will extend the API of the control accordingly.
The lack of a SelectedIndex property is because of some performance considerations we have once when initially developing the concept of the control.
Greetings,
Deyan
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
FEDERICO
Top achievements
Rank 1
answered on 01 Jan 2014, 09:24 AM
Hi i can't o get the index of selected item when I use this:
it work well if I add item to collection manually
how can i get the index of item for the first code??? :I tks
List<
db_autori
> Lista_autori = context.db_autori.ToList();
radlist.ItemsSource = Lista_autori;
private void radlist_ItemTap(object sender, ListBoxItemTapEventArgs e)
{
int index = this.Lista_autori.IndexOf(this.radlist.SelectedItem as db_autori);
MessageBox.Show(index.ToString());
}
it work well if I add item to collection manually
radlist.ItemsSource = Lista_autori;
db_autori federico = new db_autori();
Lista_autori.Add(federico);
how can i get the index of item for the first code??? :I tks
0
Hello Federico,
Thanks for writing.
Based on the code you are sharing I cannot exactly say what happens. Can you please open a new support ticket and attach your project so that I can directly debug the code and be able to determine the reason for the undesired behavior.
Thanks for your time.
Regards,
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINDOWS PHONE 7.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>