Reputation: 177
How to resume a page which is already opened in WP7?
For example : In P1 there are two buttons A and B,when i click A it takes me to P2 and when i come back to P1 and again click A it not working. But after i click B which takes to P3 and come back to P1 and click A its working,but button B is not.
I understand that an instance of that page is already running in the background. But don't know how to resume that page while clicking the button again.
Can anyone help with what should be done here?
Upvotes: 0
Views: 493
Reputation: 4268
When you are navigating via SelectionChanged
, you need to reset the SelectedIndex
:
public void SelectionChanged(object sender, SelectionChangedEventArgs e){
var lb = (ListBox) sender;
if (lb.SelectedIndex == -1) return;
//do your logic here
NavigationService.Navigate(///);
//reset selected index
lb.SelectedIndex = -1;
}
Edit: SelectedIndex
is not available in LongListSelector
. Use SelectedItem
instead.
void PersonSelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (buddies.SelectedItem == null) return;
Person person = buddies.SelectedItem as Person;
if (person != null)
{
NavigationService.Navigate(new Uri("/Samples/PersonDetail.xaml?ID=" + person.ID, UriKind.Relative));
}
buddies.SelectedItem = null;
}
Upvotes: 1
Reputation: 10509
Use
NavigationService.Navigate(new Uri("/P2.xaml", UriKind.Relative));
to navigate to P2 given that P2.xaml is your P2 page.
Upvotes: 0