in XAML:
<phone:LongListSelector x:Name="LngLstSel" SelectionChanged="LngLstSel_SelectionChanged">
In CodeBehind (C#):
private void LngLstSel_SelectionChanged(object sender, SelectionChangedEventArgs e) { // If selected item is null, do nothing if (LngLstSel.SelectedItem != null) { // Place your logic here. // Reset selected item to null LngLstSel.SelectedItem = null; } }Just make sure to check that the LongListSelector's SelectedItem property is not null and after doing your actions in the event, set the LongListSelector's SelectedItem property to null. This will clear off the bug that can happen if you want to select the same item consequently, because the event raises when an item selection is changed.
No comments:
Post a Comment