Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It would seem that you have indeed discovered a bug with the AppliationSettings object. If you are intent on storing DateTimeOffset values in the ApplicationSettings, then this approach will work.</p> <p>Create a class with your settings:</p> <pre><code> public class MyAppSettings { public DateTimeOffset Foo { get; set; } public DateTimeOffset Bar { get; set; } } </code></pre> <p>Change your methods as follows:</p> <pre><code> private void Save() { Collection&lt;MyAppSettings&gt; myAppSettings = new Collection&lt;MyAppSettings&gt;(); myAppSettings.Add(new MyAppSettings { Foo = new DateTimeOffset(2012, 12, 12, 12, 12, 12, TimeSpan.Zero), Bar = new DateTimeOffset(2011, 11, 11, 11, 11, 11, TimeSpan.Zero) }); IsolatedStorageSettings.ApplicationSettings["MyAppSettings"] = myAppSettings; } private void Load() { Collection&lt;MyAppSettings&gt; myAppSettings = (Collection&lt;MyAppSettings&gt;)IsolatedStorageSettings.ApplicationSettings["MyAppSettings"]; string foo = myAppSettings.First().Foo.ToString(); string bar = myAppSettings.First().Bar.ToString(); } </code></pre> <p>However, I would read this answer for a technique to store this type of information in your own settings file. <a href="https://stackoverflow.com/questions/6684416/windows-phone-7-isolatedstoragesettings-applicationsettings-complex-data">windows phone 7 IsolatedStorageSettings.ApplicationSettings complex data</a></p> <p>Additionally, you could approach this with even more simplicity and avoid using a Collection by changing your Save and Load methods as follows.</p> <pre><code> private void Save() { MyAppSettings myAppSettingsSimple = new MyAppSettings { Foo = new DateTimeOffset(2012, 12, 12, 12, 12, 12, TimeSpan.Zero), Bar = new DateTimeOffset(2011, 11, 11, 11, 11, 11, TimeSpan.Zero) }; IsolatedStorageSettings.ApplicationSettings["MyAppSettingsSimple"] = myAppSettingsSimple; } private void Load() { MyAppSettings myAppSettingsSimple = (MyAppSettings)IsolatedStorageSettings.ApplicationSettings["MyAppSettingsSimple"]; txtFoo.Text = myAppSettingsSimple.Foo.ToString(); txtBar.Text = myAppSettingsSimple.Bar.ToString(); } </code></pre>
 

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