I'm try to access from code to my FlyoutItems
<classes:BCTab Title="Home" FlyoutIcon="home24.png" Tag="DASHBOARD">
<ShellContent ContentTemplate="{DataTemplate views:DashboardPage}" />
</classes:BCTab>
<classes:BCTab Title="Servizi" FlyoutIcon="camera24.png" Tag="SERVICES" >
<ShellContent ContentTemplate="{DataTemplate views:ServicesPage}" />
</classes:BCTab>
<classes:BCTab Title="Change Password" FlyoutIcon="password24.png" Tag="CHGPASSWOR">
<ShellContent ContentTemplate="{DataTemplate views:ChangePasswordPage}" />
</classes:BCTab>
</FlyoutItem>`
BCTab is a derived class from Tab with some properties added
in c# I wrote
foreach (var item in this.FlyoutItems)
{
// now here???
}
I wanna show or hide the tab element.. permission cames from a REST service that gives me a code (one of the added properties in a List < string >).. it would be simple if I can access to a BCTab element via "item.controls" or "item.childelements" (or somewhat similiar) but I'm unable to understand how to do and all my searches are vain.
Any suggestion?
In debug look at item class and properties, searched on google and MS documentation
I was able to solve this. It ended up being easier than I believed.
Flyoutitemsis anIEnumerableof objects (the same container in XAML between his marking tags). In my specific case, I know they are all ofBCTab(the class I derived fromTab), so I use theToList <BCTab>()extension.In a more generic way, it's possibile to use
ToList<object>()orToList<View>()and thus verifying the correct type (usuallyTab). With a simple cast of the object, it's then possible to work on the object.