Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Methods to pass parameters</p> <p>1.Using the query string</p> <p>You can pass parameters through the query string, using this method means have to convert your data to strings and url encode them. You should only use this to pass simple data.</p> <p>Navigating page:</p> <pre><code>page.NavigationService.Navigate(new Uri("/Views/Page.xaml?parameter=test",UriKind.Relative)); </code></pre> <p>Destination page:</p> <pre><code>string parameter = string.Empty; if (NavigationContext.QueryString.TryGetValue("parameter", out parameter)) { { this.label.Text= parameter; } </code></pre> <p><br> <br> 2.Using NavigationEventArgs</p> <p>Navigating page:</p> <pre><code>page.NavigationService.Navigate(new Uri("/Views/Page.xaml?parameter=test",UriKind.Relative)); </code></pre> <p>// and ..</p> <pre><code>protected override void OnNavigatedFrom(NavigationEventArgs e) { // NavigationEventArgs returns destination page Page destinationPage = e.Content as Page; if (destinationPage != null) { // Change property of destination page destinationPage.PublicProperty = "String or object.."; </code></pre> <p>Destination page:</p> <pre><code>// Just use the value of "PublicProperty".. </code></pre> <p><br> <br> 3.Using Manual navigation</p> <p>Navigating page:</p> <pre><code>page.NavigationService.Navigate(new Page("passing a string to the constructor")); </code></pre> <p>Destination page:</p> <pre><code>public Page(string value) {// Use the value in the constructor...} </code></pre> <p>Difference between Uri and manual navigation I think the main difference here is the application life cycle. Pages created manually are kept in memory for navigation reasons. Read more about it here.</p> <p>Passing complex objects You can use method one or two to pass complex objects (recommended). You can also add custom properties to the Application class or store data in Application.Current.Properties.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload