Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Silverlight - How to navigate from a User Control to a normal page?

If I do this inside a User Control:

NavigationService.Navigate(new Uri("/Alliance.xaml", UriKind.Relative));

it says this error:

An object reference is required for the non-static field, method, or property 'System.Windows.Navigation.NavigationService.Navigate(System.Uri)'

Thank you


Well, I solved passing the normal Page as an argument to the User Control, so I could get the NavigationService.

like image 302
Alan Avatar asked Sep 16 '10 19:09

Alan


1 Answers

(Application.Current.RootVisual as PhoneApplicationFrame).Navigate(uri);
like image 112
Waleed Avatar answered Nov 04 '22 17:11

Waleed