Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
925
Persistence Framework - xamMap
posted

Hi,

Does the persistence framework work with the xamMap controls? It errors on Save() when I attempt to save the state of the map.

Regards,

Chris

Parents
No Data
Reply
  • 925
    posted

    Hi,

    Have now tried this with the simplest of Persistence Settings and still no joy. The following code results in a StackOverflow exception from System.Windows.dll being thrown:

    private void Button_Click(object sender, RoutedEventArgs e)
            {
                var settings = new PersistenceSettings
                                   {
                                       SavePersistenceOptions = PersistenceOption.OnlySpecified
                                   };

                var pnpi = new PropertyNamePersistenceInfo {PropertyName = "Width"};

                settings.PropertySettings.Add(pnpi);

                var stream = PersistenceManager.Save(map, settings);

                using (var iso = IsolatedStorageFile.GetUserStoreForApplication())
                {
                    if (iso.FileExists("map"))
                        iso.DeleteFile("map");

                    using (var isoStream = new IsolatedStorageFileStream("map"FileMode.OpenOrCreate, iso))
                    {
                        isoStream.Write(stream.ToArray(), 0, (int)stream.Length);
                    }
                }
            }
    All I wish to persist is the WindowZoom, WindowScale and WindowCenter of the map. 
    Is this possible with the Persistence Framework?
    Regards,
    Chris
Children