Search code examples
c#windows-phone-8listboxselecteditemlonglistselector

Can't select the same item from listbox twice in a row - windows phone 8 C#


I'm using SelectedChanged event in ListBox and LongListSelector but it is not fire when I choose the same item for a second time in a row, and that is true. But, I need to make an action if I selected the same item more than one time.

I find a solution which set the SelectedIndex = -1 in ListBox , and set the SelectedItem = null in LongListSelector.

But, It is not work with me as I need the data of the SelectedItem in another view.

How Can I do this?

Thanks,


Solution

  • Your approach of setting SelectedIndex = -1 in ListBox , and set the SelectedItem = null is correct. Only you need to do this in the 'navigationto' event of the page that holds the listview. That way you'll only clear it when you are again on the list page.