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
http://letmegooglethat.com/?q=xamarin+forms+database :) Xamarin has been around for quite some time now, there are endless amounts of resources available. I will say if you are looking for local storage on the device itself, you will want to get familiar with SQLite
https://learn.microsoft.com/it-it/xamarin/get-started/tutorials/local-database/?tabs=vswin
https://devblogs.microsoft.com/xamarin/persisting-settings-preferences-mobile-apps-xamarin-essentials/