How do I change the value of selectedIndex in a RadListPicker
source link: https://www.codesd.com/item/how-do-i-change-the-value-of-selectedindex-in-a-radlistpicker.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
How do I change the value of selectedIndex in a RadListPicker
In my Windows Phone app, I'm overriding the OnNavigatedTo
method to populate a RadListPicker
with some information. I have two arrays: one is a pre-filled DateTime array of size n, the second is a pre-filled string array of size n. I wanted to assign these two arrays to the RadListPicker
, such that the string array is what's displayed i.e. what the user sees as choices, and the DateTimeArray to be what RadListPicker.SelectedValue returns.
When I tried it this way, I got a debugger break
private void ShowResults(DateTime[] arrayDateTime, string[] arrayString, timeTypeEnum timeType)
{
radListPicker.ItemsSource = arrayString;
radListPicker.SelectedValue = arrayDateTime;
radListPicker.SelectedIndex = 4;
}
How can I fix this?
Freakishly , this value arrayDateTime
is a DateTime[] Array
so you need to have selected ItemIndex or some ordinal value for example
radListPicker.SelectedValue = arrayDateTime[radListPicker.SelectedItemIndex];
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK