Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Load data from API once and use it throught multiple pages, where to store List with data

When users opens app, FirstPage is loaded, where there is a list of news and some other non-related data is loaded. Then I have a separated page (NewsPage) where same news are loaded (I get data for both pages from one URL).
I want to optimize this, so app doesn't go out to get the same data twice, and when news are loaded on FirstPage, I want to store them somewhere and then access it from NewsPage.

From pageVM I call NewsService, which returns List. Do I set public List here?

What's the best approach to do this? Where do I store List so both Pages can access, read and modify this list (I'm using MVVM pattern with no frameworks).

Best Answers

  • rozman50rozman50 Member ✭✭
    Accepted Answer

    Since I have static class ApplicationSettings, where I keep some stuff about application. There I created public static List and saved it in there.
    I hope this doesn't break MVVM too much.

Answers

  • rozman50rozman50 Member ✭✭
    Accepted Answer

    Since I have static class ApplicationSettings, where I keep some stuff about application. There I created public static List and saved it in there.
    I hope this doesn't break MVVM too much.

Sign In or Register to comment.