Windows phone 7 导航控制(使用功能)

Windows phone 7 导航控制(使用功能),windows-phone-7,Windows Phone 7,我的问题与我在这里看到的例子有些不同 我在每一页上都有一个导航用户控件。 在一个典型的页面上,我有我的按钮点击事件 private void butArtists_Click(object sender, RoutedEventArgs e) { PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame; MainPage

我的问题与我在这里看到的例子有些不同

我在每一页上都有一个导航用户控件。 在一个典型的页面上,我有我的按钮点击事件

private void butArtists_Click(object sender, RoutedEventArgs e)
    {           
        PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame;
        MainPage mp = frame.Content as MainPage;
        mp.PlayerMenu("Artists");
    }
当我在MainPage.xaml上时,代码运行良好。但当我在PGA上时,什么都没发生。我认为正在发生的是页面正在设置但没有显示

我在上述函数和类似函数上设置断点。我说得对吗


因此,问题在于,当用户控件嵌入到PGA中时,框架内容不会切换回主页。

在Windows Phone上,页面导航不是这样工作的。请签出“”


您应该使用每页提供的NavigationService,而不是直接摆弄PhoneApplicationFrame。

从任何页面使用类似的内容:

var uriFragment = @"views/ArtistsView.xaml";
(App.Current.RootVisual as Frame).Navigate(new Uri(uriFragment, UriKind.Relative));

如果不在主页面上,
frame.Content as MainPage
将返回
null
如何设置函数参数?查询字符串?查询字符串适用于页面之间传递的简单数据。对于更复杂的数据,您需要使用其他一些方法来存储页面之间共享的应用程序状态。这些更复杂的方法是什么?Windows Phone的主要推荐架构模式称为。在本文中,有一个静态对象,它包含页面之间共享的状态。