Answer the question
In order to leave comments, you need to log in
Silverlight, Windows Phone 7 Mango + NavigationServices.Navigate()?
The essence of the problem: when calling NavigationServices.Navigate () from a class belonging to some xaml-view, the navigation works, but when called from any auxiliary class, for some reason it doesn’t.
For example:
page MainPage.xaml, class MainPage.xaml.cs, method
NavigationServices.Navigate( new Uri("/listItems", UriKind.Relative/Absolute) )
public void processResponce(item Response)
{
try
{
var token = Response.result.token;
this.setToken("&token=" + token);
Debug.WriteLine(this.apiUrl);
(Application.Current.RootVisual as PhoneApplicationFrame).Navigate(new Uri("/listItems", UriKind.Relative));
}
catch
{
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
var messageFromServer = Response.error.message;
MessageBox.Show(messageFromServer);
Debug.WriteLine(messageFromServer);
});
}
}
Answer the question
In order to leave comments, you need to log in
I'm a fool. Killed 4 hours for this. But the answer is right there! :)
If anyone encounters a similar issue, here is the answer:
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
(Application.Current.RootVisual as PhoneApplicationFrame).Navigate(new Uri("/listItems", UriKind.Relative));
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question