Use a database, a file, Xamarin Essentials Preferences
Xamarin: How to keep persistent data with Observable collection?
Dsto
1
Reputation point
Hi All,
I am using a simple Observable Collection to store list entries in my notepad app. I have ICommands to add and remove entries from the List.
public ObservableCollection<string> ListItem { get; set; }
public string Items { get; set; }
public MainPageViewModel()
{
ListItem = new ObservableCollection<string>();
}
At the moment, Items that I add to the list do not persist after closing the app. I can add an item to the list, but when I close and reopen the app, the list is empty.
I would like for the entries that are held in the List ( the Observable Collection) to remain between sessions.
So far I can add and delete from the list, but nothing is persistent.
Thanks