Few Xamarin Better Practice Tips

2017/03/311 min read
bookmark this
Responsive image

Table of Contents

  1. Better Practice
  2. Use CachingStrategy="RecycleElement" for ListView

Better Practice

Yeah, hard to be the best, I think depend on the Enviroment or what you try to build the Practice of how to build Xamarin might end up differently.

avoid use x:Name= at the control

It's better to use Xamarin's MVVM model to bind value to the UI, so you don't have dependency of UI and backend Model. For instance, if you have x:Name on your XAML, you C# side is using that name, then if you just remove the entire XAML section and replace the new one, build failed. Your XAML is tired to the XAML.cs code.



Use CachingStrategy="RecycleElement" for ListView

Use RecycleElement for ListView's CachingStrategy, this is better performance.