Forum Xamarin Xamarin.Forms

Shell - IsVisible

JIMR7769JIMR7769 Member ✭✭

I am new to using Shell and Xamarin forms in general. I watched a presentation where shell items could be hidden using the property IsVisible but I can't find any documentation on that feature. I have installed the latest pre-release NuGet to see if it was on the up and coming but it's not coming up via IntelliSense in the XAML editor or when building my shell in c sharp there are is no IsVisible property.

I need to have a group of views with top tabs that can only be navigated to programmatically, I am open to other solutions to this use case.

Answers

  • LandLuLandLu Member, Xamarin Team Xamurai

    I've no idea about this IsVisible property. Could you please share the presentation here?
    However, we could dynamically add or remove the specific item of the shell so that it looks like an isVisible feature.
    For FlyoutItem:

    // Define an item in code behind
    CustomFlyoutItem = new FlyoutItem
    {
        Title = "CustomItem",
        Items =
        {
            new Tab
            {
                Title = "NewTab",
                Items =
                {
                    new ShellContent
                    {
                        ContentTemplate = new DataTemplate(typeof(ItemsPage))
                    }
                }
            }
        }
    };
    // Add it into the Shell
    Items.Add(CustomFlyoutItem);
    // Remove
    Items.Remove(CustomFlyoutItem);
    

    For Tab in flyout item:

    var newTab = new Tab
    {
        Title = "NewTab",
        Items =
        {
            new ShellContent
            {
                ContentTemplate = new DataTemplate(typeof(ItemsPage))
            }
        }
    };
    MyFlyoutItem.Items.Add(newTab);
    

    MyFlyoutItem is a flyout item in Xaml:

    <FlyoutItem x:Name="MyFlyoutItem">
        <Tab Title="About" Icon="tab_about.png">
            <ShellContent ContentTemplate="{DataTemplate local:AboutPage}" />
        </Tab>
    </FlyoutItem>
    
  • JIMR7769JIMR7769 Member ✭✭

    Hi there thanks for the response.

    The presentation is here:

    As for your solution, it seems interesting. So I can just add something add runtime, navigate to it and then remove it once it's presented to the user? I already set most of my shell up in c sharp instead of XAML so this approach has promise. That IsViisible bindable property would certainly be more elegant though ;)

  • LandLuLandLu Member, Xamarin Team Xamurai

    I don't know which version of Xamarin Forms the video consumed. I remembered it was in preview before 4.2 so maybe the video involved some experimental features.
    But now, I can't set a IsViisible property directly to Tabbar or FlyoutItem. We add or remove the items dynamically at runtime as I showed above.

Sign In or Register to comment.