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

Selected Item?

2 Answers 46 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
natalya
Top achievements
Rank 1
natalya asked on 02 Nov 2010, 10:30 PM
Whats the code to have the item selected on the InfiniteListBox?

I have:
radInfiniteLIstBox  is my listbox populated by your example items
resultText  is Textblock showing the result string of the selection.

This code works with regular Listbox, but not with InfiniteListBox...is there a logic error or are things handled differently?

Thanks!

 private void radInfiniteListBox_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
        {
            object item = radInfiniteListBox.SelectedItem;
            InfiniteListBoxItem listboxItem = item as InfiniteListBoxItem;

            if (listboxItem == null)
            {
                resultText.Text = "No item currently selected.";
            }
            else
            {
                resultText.Text = listboxItem.Content.ToString();
            }
        }

2 Answers, 1 is accepted

Sort by
0
Brian
Top achievements
Rank 1
answered on 03 Nov 2010, 02:43 PM
I have the exact same issue.  When I handle the SelectionChanged event all I see is the item that is currently selected.  How do I know if the event has been fired because of a flick or scroll vs selection?  Sorry for my ignorance I am pretty new to Silverlight.

Glad you decided to bring out Mobile Controls!
0
Georgi
Telerik team
answered on 03 Nov 2010, 04:02 PM
Hi guys,

Thank you for your feedback - it is most welcome and appreciated.

@Natalya:
The RadInfiniteListBox behaves a bit differently when it comes about selection. Since it loops a rangle of logical items simply setting the SelectedItem will not do the job. Instead you should call the following method which will set the specified logical index as Selected and will center the item associated with it within the list:

this.radInfiniteListBox.CenterSelectedIndex(4);

Still, the method name is a bit confusing and we will update it for our next CTP, it should be something like SelectAndCenterLogicalIndex.

Please, note that we will also expose the more flexible and fast RadLoopingList control. It is currently used internally by our Date/Time pickers and is not polished for public use but we have plans to update it.

@Brian:
RadInfiniteListBox does not provide a convenient way to determine the reason for a selection change. This however is implemented in our RadLoopingList, which, as I mentioned, will be publicly available for our next CTP.

All the best,
Georgi
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
General Discussions
Asked by
natalya
Top achievements
Rank 1
Answers by
Brian
Top achievements
Rank 1
Georgi
Telerik team
Share this question
or