I bought this template and i want to use Command or Clicked event on tab section. When I clicked the tab it goes to the page but page created at once while program is on but i want to make control each time when page created. How can i use Command or Clicked event on tabbar.
<Tab Title="{x:Static res:AppResources.Home}" Route="home" >
<Tab.Icon>
<FontImageSource FontFamily="MaterialOutlined" Glyph="{x:Static md:Icons.Home}" />
</Tab.Icon>
<ShellContent ContentTemplate="{DataTemplate views:HomePage}" />
</Tab>
<Tab Title="{x:Static res:AppResources.Cart}" Route="cart" >
<Tab.Icon>
<FontImageSource FontFamily="MaterialOutlined" Glyph="{x:Static md:Icons.ShoppingCart}" />
</Tab.Icon>
<ShellContent ContentTemplate="{DataTemplate views:CartPage}" />
</Tab>
<Tab Title="{x:Static res:AppResources.MyAccount}" Route="myaccount">
<Tab.Icon>
<FontImageSource FontFamily="MaterialOutlined" Glyph="{x:Static md:Icons.Person}" />
</Tab.Icon>
<ShellContent ContentTemplate="{DataTemplate views:LoginPage}" />
</Tab>
</TabBar>
You can try to add a property changed event to the tabbar. Such as:
private void TabBar_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
var tabbar = sender as TabBar;
if(tabbar.CurrentItem.TabIndex == 0)
{
}else if (tabbar.CurrentItem.TabIndex == 1)
{
}
}
In the shell.xaml:
<TabBar PropertyChanged="TabBar_PropertyChanged">