How can I pass query string variables with NavigationService.Navigate?

时光毁灭记忆、已成空白 提交于 2019-12-06 12:07:49

You can use the OnNavigatedTo method in your page, and then inspect this.NavigationContext.QueryString["Elvis"] (or whatever other parameter name you like).

NavigationContext (much like NavigationService) is guaranteed to be initialized by the time OnNavigatedTo is called, so that's the most convenient time to inspect it in most cases.

NavigationContext.QueryString is simply an IDictionary that has pre-parsed the key-value pairs in the query string. As such, you can do anything you expect with an IDictionary - use ContainsKey to see if something is present, iterate over it in a foreach loop, etc.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!