WP7 Navigation exception : No Fragment support right now

I am working on WP7 app, When i was trying to navigate on same page as i was working on...my app was crashing. i was keep getting this error message "No Fragment support right now". So i googled it and find out the solution which stops crashing app.

 private void hyperlinkButtonHome_Click(object sender, RoutedEventArgs e)
        {          
            NavigateTo("/HomePage.xaml");
        }

        // prevents crash when trying to navigate to current page
        public static void NavigateTo(string url)
        {
            var frame = App.Current.RootVisual as PhoneApplicationFrame;
            if ((frame == null) || (url == frame.CurrentSource.ToString()))
                return;
            frame.Navigate(new Uri(url, UriKind.Relative));
        }

Not sure it's right solution but it stops crashing app.
Ebook Download
View all
Learn
View all