I have an mvvmcross xamarin project I am trying to figure out the best way I should approach sending data across screens for a particular situation.
My first screen is a search filter, it contains all kinds of criteria for the users to select for filtering results. The second screen is the results list screen.
I've seen numerous options for approaching this problem:
1) Use the Init method - The issue I'm having here is that when I pass custom objects, the values are always null/default. If I pass a string it works fine. If I could pass custom objects, I would either pass the EntityFilter or a List of Entities which is the results. I do have to query the entities on the filter page because what they select on one filter can affect others based on what entities remain. I have added the following to the AssemblyInfo.cs and it still doesn't work.
[assembly: InternalsVisibleTo("Cirrious.MvvmCross")]
2) Use Messaging. The problem here is that the result page isn't created when the filter is changed, so messaging won't work.
3) Use an in memory object. I created a results service that contains nothing but a public property of List of Entities. It's registered as lazy singleton in the IoC (as are all services). This method works and is my current solution. But it doesn't "feel" right. It feels like I'm doing something wrong or breaking best practices. Is this the way it should be done?