Forum Xamarin.Forms

QueryParameters v ViewModels???

shaunpryszlakshaunpryszlak USMember ✭✭✭

Just starting a new Xamarin Forms 4 app and I have a question about the new routing navigation. I see two approaches to passing data now

1. You use the new routing navigation and pass your data as part of the query string.
2. You create a viewmodel, pass it to the pages constructor and then navigate to it.

I can see if you were coming from a web background that the former would be easy for you to get to grips with. It is essentiually an MVC site in an app. However I see a lot of difficulties with it. Firstly, everything gets turned into a string (and it doesn't even do the encoding for you) and I guess that means you can't pass arrays of objects and useful stuff like that. So what is the point of it, except for really simple apps? Is the new way anti ViewModel? Should I adopt the new methodology or stick with the existing way? Can I mix and match?

I mean I like having the shell stuff that explains the layout of the app and if you are deeplinking your app to web content then the new way is great. It was quite fiddly the old way.

Sign In or Register to comment.