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

前端 未结 8 1241
南旧
南旧 2020-12-09 18:13

If I do this inside a User Control:

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

it says this error:

8条回答
  •  猫巷女王i
    2020-12-09 18:29

    NavigationService is a class. Navigate is a method you can call on instances of that class. It is not a static method you can call from outside an object reference.

    Basically you need to get the current NavigationService for the current page. This link http://msdn.microsoft.com/en-us/library/system.windows.navigation.navigationservice.aspx should help.

提交回复
热议问题