Monday, 5 November 2012

Tips for building Windows Store apps using XAML and C++

The //build/ conference was last week and one of the many sessions was about tips for building a Windows Store app using XAML and C++. Specifically, this session was about the tips that we learnt while developing the Hilo app.

The main things we learnt, which are discussed in the video, are:

  1. Use smart pointers, stack semantics & RAII pattern.
  2. Use public ref classes only for interop.
  3. Don’t create circular references between ref classes and lambda expressions.
  4. Use explicit capture for lambda expressions.
  5. Use task cancellation consistently.
  6. Be aware of context rules for continuations of tasks.
  7. Use the LayoutAwarePage class to provide navigation, state management, and view management.
  8. Support visual state for landscape, portrait, fill and snap.
  9. Use asynchronous programming techniques to keep the UI responsive.
  10. Use the BindableBase class to provide support for MVVM.
  11. Use MVVM to build an interop layer between XAML and your models.
  12. Separate resources for each locale.
  13. Use the Calendar class to support world calendars.
  14. Save application data when the app is being suspended.
  15. When the app resumes after termination, use the saved app data to restore the app state.
  16. Release exclusive resources when the app is being suspended.
  17. Ensure your controls for tap and hold appears above the touch point.
  18. Use the standard touch gestures and controls that Windows 8 provides.
  19. Use the Windows Runtime to create image thumbnails for tiles.
  20. Ensure queries prefetch properties to improve performance.
  21. Keep the launch times of your app fast.

For more information about these tips, see the Hilo guidance.

No comments:

Post a Comment