Hello,
Welcome to our Microsoft Q&A platform!
If you want to keep the value of ListItem
utill you close your app , you can add a keyword static
for ListItem
.
public static ObservableCollection<string> ListItem { get; set; }
If you want to keep the value even after your close your app, you can use local data storage
to store your data.
1.Files
File handling with Xamarin.Forms can be achieved using code in a .NET Standard library, or by using embedded resources. This article explains how to perform file handling from shared code in a Xamarin.Forms application.
2.Local Databases
Xamarin.Forms supports database-driven applications using the SQLite database engine, which makes it possible to load and save objects in shared code. This article describes how Xamarin.Forms applications can read and write data to a local SQLite database using SQLite.Net.
For more details, you can check: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/data-cloud/data/
Best Regards,
Jessie Zhang
---
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.