Rune Hansen
Rune Hansen

Reputation: 1024

How to set the Title of a Panorama control from value in a query string?

When I navigate to a view with a Panorama control I would like to set the Title of the Panorama control, the Title value is coming in with a query string from the previous view. How do I do that?

Upvotes: 0

Views: 129

Answers (1)

Owidat
Owidat

Reputation: 1081

if you are navigating from other page:
page.xaml,cs:

    private void Navigate()
    {
        string name = "Test";
        // Navigate to Panorama page
        NavigationService.Navigate(new Uri("/Pages/PanoramaPage.xaml?name=" + name, UriKind.Relative));
    }

PanoramaPage.xaml.cs:

    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
        string name = "";
        if (NavigationContext.QueryString.TryGetValue("name", out name))
        {
            PageTitle.Text = name;
        }
    }

Upvotes: 2

Related Questions