Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

How to force Shell to redraw the bottom Tabbar

$
0
0

I have a fairly simple Tab-based UI using Shell running on Xamarin Forms 5.0. I use my Settings page to make two tab items visible to the user based upon whether or not the feature has been enabled. Here is the relevant XAML:

`

<TabBar>

... other tabs

    <Tab Route="settings"
         Title="Settings"
         >
        <Tab.Icon>
            <FontImageSource FontFamily="MatFonts"
                             Glyph="{x:Static fonts:MatFonts.Cog}"
                             Size="Large"
                             Color="{AppThemeBinding Light={StaticResource Light_IconColor},
                                                     Dark={StaticResource Dark_IconColor}}"
                             />
        </Tab.Icon>
        <ShellContent ContentTemplate="{DataTemplate views:SettingsView}" />
    </Tab>

    <Tab Route="about"
         Title="About"
         >
        <Tab.Icon>
            <FontImageSource FontFamily="FAFonts"
                             Glyph="{x:Static fonts:FAFonts.Question}"
                             Size="Large"
                             Color="{AppThemeBinding Light={StaticResource Light_IconColor},
                                                     Dark={StaticResource Dark_IconColor}}"
                             />
        </Tab.Icon>
        <ShellContent ContentTemplate="{DataTemplate views:AboutView}" />
    </Tab>

    <Tab x:Name="caloriesTab"
         IsVisible="{Binding BulkEntryEnabled}"
         Route="caloriesdataentry"
         Title="Calories Bulk DataEntry"
         >
        <Tab.Icon>
            <FontImageSource FontFamily="FAFonts"
                             Glyph="{x:Static fonts:FAFonts.BalanceScale}"
                             Size="Large"
                             Color="{AppThemeBinding Light={StaticResource Light_IconColor},
                                                     Dark={StaticResource Dark_IconColor}}"
                             />
        </Tab.Icon>
        <ShellContent ContentTemplate="{DataTemplate views:BulkCalorieEntry}" />
    </Tab>

    <Tab x:Name="weightTab"
         IsVisible="{Binding BulkEntryEnabled}"
         Route="weightdataentry"
         Title="Weight Bulk DataEntry"
         >
        <Tab.Icon>
            <FontImageSource FontFamily="FAFonts"
                             Glyph="{x:Static fonts:FAFonts.Weight}"
                             Size="Large"
                             Color="{AppThemeBinding Light={StaticResource Light_IconColor},
                                                     Dark={StaticResource Dark_IconColor}}"
                             />
        </Tab.Icon>
        <ShellContent ContentTemplate="{DataTemplate views:BulkWeightEntry}" />
    </Tab>
</TabBar>

`

I cannot figure out how to force Shell to repaint the bottom Tabbar when the IsVisible property, which is bound, is toggled. The user is forced to exit the application and restart it, which is a royal pain. I would appreciate a pointer on how to accomplish this if it is possible.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>