I have on MainPage of Application a Shell with TabBar with many Tab(s).
I would like to know if there is any possibility to find out in C# code tab titles from TabBar from Shell in a .NET MAUI application
I require to memorize in a model if the tabs are visible or not and would not like the approach to entry them by hand. An iteration on TabBar children would avoid this.
Application is .Net 6 MAUI version.
I tried finding out ways to access TabBar object from Shell but could not find any way in Shell object API.
The
TabBaris part of theShellso to get to the current shell object you need to use theCurrentproperty that holds this instance of the Shell. With this you find all the Items in the shell, which is aShellItemCollection, ie TabBar.To get all the visable tabs is a bit tricky. But if you look inside the class
ShellItemyou findGetItemsThis is part of
IShellItemControllerthatShellItem, ieTabBar, inherent so we get to use it like this.To put it all together and clean it up a bit we can put this in a List that gives us all information about our tabs