Which best practices to follow while designing the XAML Page?

Technology CommunityCategory: XamarinWhich best practices to follow while designing the XAML Page?
VietMX Staff asked 3 years ago
  • Don’t create UI in code behind. Use XAML for it because XAML is more readable then code.
  • Avoid using a RelativeLayout. It asks CPU to perform significantly more work.
  • Enable the XAML Compiler. It performs compile time checking of XAML for any errors and removes some of the load.
  • Use correct layout to achieve desired UI. Don’t use StackLayout if the same can be achieved by using GridGrid is more lightweight then StackLayout.
  • Use Layout Compression to improve the Page rendering performance.
  • Don’t use Binding when there is no need to. Example: if Button title is not dynamic, then give it statically in XAML itself.
  • Don’t set the VerticalOptions and HorizontalOptions properties of a layout unless required.
  • Always try to reduce the Visual Tree Size.
  • Reduce the Application Resource Dictionary Size.