Can app data for WPF apps be saved per instance of the app?

When a user has multiple instances of my WPF app saved in a workspace, I'd like the app to save app data such as say a currency pair in focus or a radio button selected to be saved per instance of the app, so that when the workspace is opened each app is restored to the state the user saved it in. Could IAppHost.PreferencesStore or IAppHost.Storage services provide the solution here? Does either of these services save the app data per instance of the app? Or do both of these services not distinguish which instance of the app saves the data?

Best Answer

  • Jirapongse
    Answer ✓

    I used State Persistence as mentioned in this tutorial.

    Persisted state

    A built-in serialization mechanism can be used to persist the app’s data between different instances. The data, that is saved, will be injected as an instance of an XmlReader to the respective constructor.

    ...

Answers