DEV Community

David Ortinau for .NET

Posted on

2

Hide Shell Flyout Items and Tabs in Xamarin.Forms

Xamarin.Forms Shell has an IsVisible property you can use to show and hide pages in a flyout or tab bar, and control if those pages are routable based on any criteria such as authorization role.

<TabBar Route="main">
<Tab Title="Browse" Icon="tab_feed.png">
<ShellContent
ContentTemplate="{DataTemplate local:ItemsPage}" />
</Tab>
<Tab Title="About" Icon="tab_about.png">
<ShellContent
ContentTemplate="{DataTemplate local:AboutPage}" />
</Tab>
<Tab Title="Admin" IsVisible="{Binding IsAdmin}">
<ShellContent
ContentTemplate="{DataTemplate local:AdminPage}"/>
</Tab>
</TabBar>
view raw IsVisible.xaml hosted with ❤ by GitHub

Resources

GitHub logo davidortinau / ShellLoginSample

Sample of how you can do a LoginPage flow with Shell in v4.1

Top comments (1)

Collapse
 
yapmq profile image
yapmq • Edited

when i tried to apply the same logic to flyoutitem, the IsAdmin value always returns false for some reason. I have tried placing breakpoints during debugging and the value on the code behind was true before being pushed into the page. Any idea what did i do wrong?

my modified code: dev-to-uploads.s3.amazonaws.com/up...

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay