Skip to content

Tutorial Part 4 Tabbed Pages

slodge edited this page Mar 10, 2012 · 2 revisions

*** THIS CONTENT IS VERY DRAFT ***

Tabbed pages are a familiar feature of Android and iPhone apps, while Windows Phone instead offers Panorama and Pivot controls.

For the mvvmcross framework, you have several choices about how you can implement these "composite" views on each platform.

What I recommend for most general situations is:

  • you implement a single ViewModel for the parent page
  • that parent page owns several child ViewModels -exposed as public properties - 1 for each "tab".
  • in the individual platforms:
  • in Android you can either:
    • use the SetContent(viewId) method to setup each tab using normal databinding
    • or you can separate out each tab into its own Mvx-Activity
  • in iOS, you can use normal UITabBarController along with TabBarItems on each tab
  • in WP7 you can use normal data-binding to setup each pivotitem or panoramaitem

I've demonstrated this in principle in the CompositeView demo tutorial - however, please note that the child views for this project aren't setup ideally - instead they are simply hacked in from the other projects - so this is not an ideal demo visually, especially for wp7