Modern UI for WPF- navigation

前端 未结 2 1021
醉梦人生
醉梦人生 2021-01-27 16:29

How can I pass parameter beetwen pages? I\'ve tried to add parameters to page uri but it didn\'t work because I can\'t use onNavigatedTo event on user control. Please help

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-27 17:00

    You must use OnFragmentNavigation.

    public void OnFragmentNavigation(FragmentNavigationEventArgs e)
    {
      DoYourStuff(e.Fragment)
    }
    

    e.Fragement contains everything past the # in the URI. In example, using

    NavigationCommands.GoToPage.Execute("/Pages/CustomerPage.xaml#CustomerID=12345", this);
    

    e.Fragment will be "CustomerID=12345"

提交回复
热议问题