You could define the ShellSection according to the tab in xaml , and exchange them in code .
var item1 = new ShellSection
{
Title = "111",
Items = {
new ShellContent
{
Title = "Dogs",
Icon = "dog.png",
ContentTemplate = new DataTemplate(typeof(DogsPage))
},
new ShellContent
{
Title = "Cats",
Icon = "cat.png",
ContentTemplate = new DataTemplate(typeof(CatsPage))
}
}
};
var item2 = new ShellSection
{
Title = "222",
Items = {
new ShellContent
{
Title = "Bears",
Icon = "bear.png",
ContentTemplate = new DataTemplate(typeof(BearsPage))
},
new ShellContent
{
Title = "Monkeys",
Icon = "monkey.png",
ContentTemplate = new DataTemplate(typeof(MonkeysPage))
}
}
};
tabbar.Items[0] = item2;
tabbar.Items[1] = item1;
Answers
Suffle position above two tabar items of shell.
We could swap the
Title
,Icon
,Route
of that two tabs to simulate the position exchange .set X:Name on the two tab
swap the properties code behind.
Test on my side , it works fine .
Working fine to scuffle tabbar icon, Also want to scuffle ShellContent inside the Tabbar.
@ColeX I am unable to scuffle ShellContent inside the tabbar proggrametically in runtime
I want scuffle two tab by code behind programetically
I found another way .
You could define the ShellSection according to the tab in xaml , and exchange them in code .