I have this settings class
class AppSettings : ApplicationSettingsBase
{
[UserScopedSettingAttribute()]
public ObservableCollection<TrackViewModel> TracksViewModel
{
get { return (ObservableCollection<TrackViewModel>)(this["TracksViewModel"]); }
set { this["TracksViewModel"] = value; }
}
...
TracksViewModel has a property Track (my Model), which is a class. Also this class has a empty constructor, so I guess this make no problem.
Anyway, when I save Settings, all the Properties are saved but Track object. In output debug I got no errors.
Any suggestion ?
How does the appsettings know they type of the ViewModel? You may want to check the serialization of that object.
Or, you many want to not use appsettings for this and roll your own xml file for persisting that stuff.
Here are several links:
http://www.codeproject.com/Articles/6730/Custom-Objects-From-the-App-Config-file
How to store class object in app config file
Can I save an object to the app.config file?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.