Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9014707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:34:26+00:00 2026-06-16T03:34:26+00:00

The documented way to navigate to another XAML page while passing in data seems

  • 0

The documented way to navigate to another XAML page while passing in data seems to be by serializing the data as URL parameters. This works great for simple parameters, such as a single database key:

NavigationService.Navigate(new Uri("/ViewContact.xaml?contactid=" + cid, UriKind.Relative));

However, what if you want to pass in a rather complicated data structure, such as a search query? This query might have keywords, various filters, arrays of items, etc. It would be rather difficult to express this sort of data using URL parameters.

Question: What is the recommended technique to navigate to another page, passing in non-trivial parameters?

One idea would be to first set the data or query as a static property of the page you’ve navigating to:

Query q = new Query();
// Set various parameters
ViewContact.SearchQuery = q;
NavigationService.Navigate(new Uri("/ViewContact.xaml?contactid=", UriKind.Relative));

Then, when ViewContact was loaded, it would check that static property and load the data into memory.

Anything wrong with this approach, or is there another method that’s recommended?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T03:34:28+00:00Added an answer on June 16, 2026 at 3:34 am

    Take a look at this thread on the Prism discussion board: Navigation using Object as parameter.

    Near the end, there is a solution using a NavigationUri class derived from Uri:

    public sealed class NavigationUri : Uri
    {
      public NavigationUri(string uri)
        : base(uri, UriKind.Relative)
      {
        Parameters = new Dictionary<string, object>();
      }
    
      public Dictionary<string, object> Parameters
      {
        get;
        private set;
      }
    }
    

    (I made the constructor public)

    You can then use it like so:

    var uri = new NavigationUri("/ViewContact.xaml");
    uri.Parameters["SearchQuery"] = q;
    NavigationService.Navigate(uri);
    

    Then, in the OnNavigatedTo method of your ViewContact:

    public override void OnNavigatedTo(NavigationContext navigationContext)
    {
      var uri = (NavigationUri)navigationContext.Uri;
      SearchQuery = (Query) uri.Parameters["SearchQuery"];
    }
    

    As suggested in the original thread, you can also use a class to generate the parameter keys instead of hardcoding them:

    public sealed class NavigationUriParameters
    {
        public static readonly string SearchQuery = Guid.NewGuid().ToString();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm posting data to a page and after that I want to navigate to
Is there another way to load MSHTML documents without use Application.ProcessMessages? To load a
I am looking for a way to extract / scrape data from Word files
i was wondering if the solution for this documented here is still the solution
I have next link that lets users navigate through a list of URL (stored
I was wondering what is the best way of checking if a page is
Is there a way to tell browser to show a loader image while a
Can someone tell me why the way I am binding data here does not
As I understand XPath, it is a way to navigate through elements in an
I know what's the standard way to document functions, classes and modules, but how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.