简体   繁体   中英

How can i open up a simple page from my panorama app?

I have a panorama app and made a button on one of the pages. How can open up a page when the user clicks the button?

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            SearchPage sp = new SearchPage();
            sp.Visibility = System.Windows.Visibility.Visible;

Now, the sp.Visibility seems to be the wrong way to go about it. Could anyone help me figuring out how I show secondary pages?

当你说一个页面时,你的意思是申请中的panoramaitem或新页面?

Just like web applications, in your silverlight application you need to redirect the user to the next page.

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

you can pass parameters to your page by adding query string parameters:

NavigationService.Navigate(new Uri("/SearchPage.xaml?name=" + txtName.Text, UriKind.Relative);

and in SearchPage.cs you can retrieve the query string by saying this:

protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
    var name = NavigationContext.QueryString["name"];
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM