简体   繁体   中英

Navigation Issues Windows Phone 8.1

I have this unusual issues to navigate in Windows Phone 8.1

Here is my code :

try
{
    news c = news_List.SelectedItem as news;
    Frame.Navigate(typeof(Pages.newsItem), c);
}
catch(Exception ex)
{
    MessageDialog j = new MessageDialog(ex.Message);
    await j.ShowAsync();
}

So the problem is for Windows Phone 8.1, sometimes when I click on the element the application crash, and that's it nothing else. On debug mode nothing appends, and on Windows 10 Mobile it works like a charm...

Use this

try
{
    news c = news_List.SelectedItem as news;
    await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => this.Frame.Navigate(typeof(Pages.newsItem), c));
}
catch(Exception ex)
{
    MessageDialog j = new MessageDialog(ex.Message);
    await j.ShowAsync();
}

and don't forget to add async in the method and make sure that you are getting the data on another page.

use news c = news_List.SelectedItem as news; Frame.Navigate(typeof(PageName),c); news c = news_List.SelectedItem as news; Frame.Navigate(typeof(PageName),c);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM