Implement tabs using TabHostView and ViewSwitcher
mainSharpnado.Tabs uses a two-part system to manage navigation:
TabHostView: The UI container for the tab bar itself. It holds variousTabItemimplementations (likeBottomTabItemorUnderlinedTabItem) and manages the visual state of the tabs. You should bind itsSelectedIndexto aViewSwitcherto synchronize the tab selection with the content view.ViewSwitcher: The container for the actual content views. It listens to theSelectedIndexand switches between its child views. To optimize performance, you can wrap your views inLazyView(loads when first needed) orDelayedView(loads after a delay, optionally showing an activity indicator).
<!-- 1. The Tab Bar -->
<tabs:TabHostView
SelectedIndex="{Binding Source={x:Reference Switcher}, Path=SelectedIndex, Mode=TwoWay}"
TabType="Fixed">
<tabs:BottomTabItem Label="Home" />
<tabs:BottomTabItem Label="Settings" />
</tabs:TabHostView>
<!-- 2. The Content Switcher -->
<tabs:ViewSwitcher x:Name="Switcher" SelectedIndex="{Binding SelectedViewModelIndex, Mode=TwoWay}">
<tabs:LazyView x:TypeArguments="views:HomeView" />
<tabs:DelayedView x:TypeArguments="views:SettingsView" />
</tabs:ViewSwitcher>