RadAreaCodePicker.ItemsSource = areaCodes.Select(s => s.AreaCode);
Debugging shows the SelectionChanged event firing with the index set to 0 (first item in the list). This causes the item to be processed which I don't want to do.
The next statement I set the selected item to the one I want as the default. If it it other than item 0, the SelectionChanged fires again.
RadAreaCodePicker.SelectedItem = areaCode;
Xaml:
<telerikInput:RadListPicker Height="72" HorizontalAlignment="Right" Margin="0,35,322,0" Name="RadAreaCodePicker" VerticalAlignment="Top" Width="65" FontWeight="Bold" FontSize="30" SelectionChanged="RadAreaCodePicker_SelectionChanged" />
Thanks,
Gary Davis
7 Answers, 1 is accepted
Thank you for writing.
You can easily skip the processing of the event by unsubscribing from selection changed, setting the new items source, setting the correct selected item and then resubscribing to the event. RadListPicker selects the first item when a new data source is set and this behavior is by design, RadListPicker does not support null selection.
Please write again if you need further assistance.
Victor
the Telerik team
radListPicker.SelectionChanged -= radListPicker_SelectionChanged;
radListPicker.ItemsSource = possibleValuesString;
radListPicker.SelectedIndex = 4;
radListPicker.SelectionChanged += radListPicker_SelectionChanged;
private
void
radListPicker_SelectionChanged(
object
sender, SelectionChangedEventArgs e)
{
Prompt.Visibility = Visibility.Visible;
}
I only want the Prompt to be visible once I select an item. Special note: I have the listpicker in a PanoramaItem and always launch it with isExpanded=true. I want the user to select an option, after which the prompt should appear.
Please explain what you mean by "it doesn't seem to be working". Is your selection changed handler called immediately after resubscribing? If so, you can delay the event subscription by using Dispatcher.BeginInvoke().
You have to subscribe to the selection changed event inside the BeginInvoke callback.
Victor
the Telerik team
And FIVE DAYS to respond to a query?
Thank you for contacting us. I've responded to your other thread where I've attached a sample. I'll add it to this thread as well for reference.
Please refer to this MSDN article on how to use Dispatcher: http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher(v=vs.95).aspx
Dispatcher.BeginInvoke: http://msdn.microsoft.com/en-us/library/cc190259(v=vs.95).aspx
Don't hesitate to contact us if you have further questions or comments.
Kiril Stanoev
the Telerik team
I've posted an answer here: http://www.telerik.com/community/forums/windows-phone-8/listpicker/bind-selecteditem-to-null.aspx. Let us know what you think.
Regards,Kiril Stanoev
Telerik
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 >>