Talk:Introduction and best practices for IsolatedStorageSettings

From Nokia Developer Wiki
Jump to: navigation, search


Chintandave er - Thanks and Sub-edited!

Hi Jinek,

Thanks for the article. I have sub-edited it and apply below template.

  • In article, if there is any class/function used, I have applied {{Icode|ClassOrFunction}} template to it.
  • If there is any page name (e.g. mainpage.xaml) make it bold. I have done it.

You might want to check out wiki help articles Help:Formatting and Help:Wiki Article Review Checklist.


Chintan Dave.

Chintandave er 07:57, 16 November 2012 (EET)

Jinek -

Thanks for editing, i'll check formatting articles

jinek 08:15, 16 November 2012 (EET)

Croozeus -

Thanks for the article Jinek. The article offers a good approach on how to store setting values of different datatypes without writing much code.

In terms of improvement, I feel you could explain the code snippets better. For example, how does the class function to work with any datatypes could be explained better. I tried to structured the sections better.

For the competition, I look forward to see more WP8 specific articles from you!


croozeus 11:51, 19 November 2012 (EET)

Hamishwillee - Subedited - some thoughts

Hi Jinek

I've subedited this a bit further for wiki style - mostly just using # for the later bullets.

In terms of the article structure, this is fairly easy to follow, and I think people will definitely learn something from it. I like how you linked to API reference on MSDN which is something that people sometimes forget. I would also add a link to http://msdn.microsoft.com/en-us/library/cc221360(v=vs.95).aspx (the HowTo) and http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff402541(v=vs.105).aspx.

My main concern with this article is that I think (not a WP expert) it solves a problem that isn't a particularly worrying use case. That is fine, but you need to be specific about when this is most useful. I guess you kind of did by saying "many settings" but it isn't completely clear why this is so useful for many settings (its implied that this is due to ease of writing code).

What I mean by this is that in the settings are automatically saved when the app is closed. If you do want to do it manually then you'd probably do it when an app page is exited (ie as part of handling possibility of going dormant). Normally you'd do this in your UI thread, and since this class is synchronous, you'd keep the number of properties that need to be saved small. So I see this as useful if you need to save a LOT of properties regularly that will take some time to save and hence you'll need to run in another thread. In this case you'd also have to consider whether perhaps using one of the other mechanisms would be more appropriate in any case.

This is not my preferred style. What it does is talk about how your app is constructed where a better approach is to discuss what any app using this feature will need to do. So for example you say "Navigate to MainPage.xaml and replace all control content with one checkbox:" - because you've done it this way it is not obvious what is actually related to using settings - most of this is just infrastructure for clicking a button. I think this is what Pankaj means by asking for more comments. If you change this round I'd be tempted to put your explanation of "Why do I use thread synchronization?" up the top of the section - ie explain what you're going to do and why first.

In terms of the competition, as far as I can see there is nothing that is WP8 specific - this is generic Windows Phone. We can consider it as an entry, but as it isn't innovative, comprehensive of shows off a real world feature of WP8 it would not be a strong contender. It is a useful topic for the wiki, though would be even better if tidied up a little.

To be a strong competition entry on settings/files data it would need to do something innovative, comprehensive or show off a real world benefit for WP8. This topic does a pretty good job of explaining the new Win32 storage APIs supported on Windows Phone 8 at high level but it doesn't cover topics in great detail like when to select WP8 methods over WP7 methods or have examples (though such may exist), how to work with the different methods on both systems, benefits/tradeoffs of the changes. There might be an opportunity there.

Hope that makes sense. Thanks again for this topic!



hamishwillee 08:35, 20 November 2012 (EET)

Raghavrags - How to do the above when checkbox in Listbox DataTemplate?

I created a button to create multiple checkbox inside a listbox on no. of clicks for wp7. Below the codes I used for it.

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">

  <TextBox x:Name="txtNewTask" HorizontalAlignment="Left" Height="72" TextWrapping="Wrap" VerticalAlignment="Top" Width="328"/>
  <Button x:Name="btnAdd" Content="add" HorizontalAlignment="Left" Margin="328,0,0,0" VerticalAlignment="Top" Width="123" Click="btnAdd_Click"/>
  <ListBox x:Name="lbToDoList" Margin="0,72,0,0">
        <CheckBox Click="CheckBox_Click" Background="{x:Null}">
          <StackPanel Orientation="Horizontal">
            <TextBlock Text="{Binding}" Name="tbkTextName" VerticalAlignment="Center" Margin="5,0,5,0" />


Now when the app is re-launched my app, the checkbox’s are unchecked (default state) and its state is not saved. Can you please help me to save the multiple checkbox's inside a listbox value or state?

raghavrags 17:26, 6 May 2013 (EEST)

Kunal Chowdhury - A query regarding app update

What will happen to it if I update the app? Will it store the data present in the settings or will flush the existing data? I guess, the second one will happen. If I am not wrong, is there any way to keep those data still in the Isolated Storage Settings in case of app update?



Kunal Chowdhury (talk) 09:33, 29 October 2013 (EET)

SB Dev -

The data in the IsolatedStorageSettings is in reality serialized to a XML file in IsolatedStorage. During regular App updates this file isn't touched so all the data is still available after the update. It's the same when you run your App regularly from Visual Studio. If you do a Rebuild (not Build) of the App though it will clean the whole IsolatedStorage when you next deploy it for debugging. Store updates still won't be affected by this though.

SB Dev (talk) 17:58, 29 October 2013 (EET)

Myexec -

This will raise an exception in the

private static void Save()

           lock (IsolatedStoragePropertyHelper.ThreadLocker)

You need to put changing the property code in the lock block. Like this:

public T Value

               //If property does not exist - initializing it using default value
               if (!Exists)
                   //Initializing only once
                   lock (_syncObject)
                       if (!Exists) SetDefault();

               return (T) IsolatedStoragePropertyHelper.Store[_name];
               IsolatedStoragePropertyHelper.Store[_name] = value;
Otherwise if some other thread had changed the same property it will raise a "Collection modified" exception on the attempt to save.

myexec (talk) 17:00, 7 March 2014 (EET)

SMEfocus - Update IsolatedStorageSettings while App update


Is there a way to update some values in IsolatedStorageSettings when my App is updated. This can be considered as settings data migration activity, which will be carried out only once - i.e. only while updating. e. g. version of my app stores a key-value pair say ID-1. Now, in version I would like this value changed to ID-2. Ideally, this should happen only when the App is updated since the new logic assumes the value of ID to be 2 and not 1.

So my question is where in the App such "settings data migration" logic can be written so that it runs only when updating or only once after the update.

Thanks in advance.

SMEfocus (talk) 10:16, 10 April 2014 (EEST)

JumpyNOKIA - Please, make a WP 8.1 version.

Please, make a WP 8.1 version.

JumpyNOKIA (talk) 13:11, 4 June 2014 (EEST)


Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.