Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you have already stored the data to local storage, you could just read it in the <code>OnNavigatedTo</code> override of the other page. Otherwise, use the navigation parameter: <a href="http://social.msdn.microsoft.com/Forums/windowsapps/en-US/8cb42356-82bc-4d77-9bbc-ae186990cfd5/passing-parameters-during-navigation-in-windows-8" rel="nofollow">http://social.msdn.microsoft.com/Forums/windowsapps/en-US/8cb42356-82bc-4d77-9bbc-ae186990cfd5/passing-parameters-during-navigation-in-windows-8</a></p> <p>Edit: I am not sure whether you also need some information about local storage. This is easy: <code>Windows.Storage.ApplicationData.Current.LocalSettings</code> has a property called Values, which is a <code>Dictionary</code> you can write your settings to. Have a look at <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh700361.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/windows/apps/hh700361.aspx</a></p> <p>Edit: Try something like this code to store your list.</p> <pre><code>// Try to get the old stuff from local storage. object oldData = null; ApplicationDataContainer settings = ApplicationData.Current.LocalSettings; bool isFound = settings.Values.TryGetValue("List", out oldData); // Save a list to local storage. (You cannot store the list directly, because it is not // serialisable, so we use the detours via an array.) List&lt;string&gt; newData = new List&lt;string&gt;(new string[] { "test", "blah", "blubb" }); settings.Values["List"] = newData.ToArray(); // Test whether the saved list contains the expected data. Debug.Assert(!isFound || Enumerable.SequenceEqual((string[]) oldData, newData)); </code></pre> <p>Note, this is only demo code for testing - it does not make real sense...</p> <p>Edit: One advice: Do not persist the list in your click handlers as this will become extremely slow as the list grows. I would load and save the list in the Navigation handlers, i.e. add something like</p> <pre><code>protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (this.ListBox1.ItemsSource == null) { object list; if (ApplicationData.Current.LocalSettings.Values.TryGetValue("List", out list)) { this.ListBox1.ItemsSource = new List&lt;string&gt;((string[]) list); } else { this.ListBox1.ItemsSource = new List&lt;string&gt;(); } } } protected override void OnNavigatedFrom(NavigationEventArgs e) { if (this.ListBox1.ItemsSource != null) { ApplicationData.Current.LocalSettings.Values["List"] = this.ListBox1.ItemsSource.ToArray(); } base.OnNavigatedFrom(e); } </code></pre>
    singulars
    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.
 

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