IsEnabled property doesn't seem to work for AppShell

Dave 1 Reputation point
2021-08-03T18:41:06.46+00:00

I want to use the IsEnabled property of ShellContent object of the AppShell, but this property doesn't seem to have any effect if True or False. If working, this property is very handy, for example, to disable user interaction until some conditions are met (such as loading a page) or to enable/disable menu items based on context (edit, delete, etc actions).

	<ShellContent Title="add"  
	              ContentTemplate="{DataTemplate views:AddPage}"  
	              Icon="{OnPlatform Default='add', UWP='Assets/Icons/add.png'}"  
	              Route="AddPage" IsEnabled="False"  
	              Style="{StaticResource AddPage}" />  

Is IsEnabled not working just a bug or am I missing something?

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,380 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Gerrit Oehlmann 6 Reputation points
    2021-08-20T07:47:17.22+00:00

    I can confirm the bug as well. <ShellContent IsVisible="True/False" /> is working fine, but <ShellContent IsEnabled="True/False" /> isn't working at all. Another obstacle I have to find a workaround for. Great.

    1 person found this answer helpful.
    0 comments No comments

  2. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 36,431 Reputation points Microsoft External Staff
    2021-08-05T08:23:11.92+00:00

    Hello,
    Welcome to our Microsoft Q&A platform!
    You are using Flyout, so you could use the IsEnabled property of FlyoutItem. You can have a try with following code:

    <FlyoutItem IsEnabled="True" Title="About" Icon="icon_about.png">  
            <ShellContent  Route="AboutPage" ContentTemplate="{DataTemplate local:AboutPage}" />  
        </FlyoutItem>  
        <FlyoutItem IsEnabled="True" Title="About2" Icon="icon_about.png">  
            <ShellContent  Route="AboutPage" ContentTemplate="{DataTemplate local:AboutPage}" />  
        </FlyoutItem>  
        <FlyoutItem IsEnabled="False" Title="Browse" Icon="icon_feed.png">  
            <ShellContent Route="ItemsPage" ContentTemplate="{DataTemplate local:ItemsPage}" />  
    </FlyoutItem>  
    

    If you want to use Tabs , you could use the IsEnabled property of Tab.

    <TabBar>  
            <Tab IsEnabled="False" Title="About" Icon="icon_about.png">  
                <ShellContent  Route="AboutPage" ContentTemplate="{DataTemplate local:AboutPage}" />  
            </Tab>  
            <Tab IsEnabled="True" Title="Browse" Icon="icon_feed.png">  
                <ShellContent  ContentTemplate="{DataTemplate local:ItemsPage}" />  
            </Tab>  
            <Tab IsEnabled="True" Title="About2" Icon="icon_about.png">  
                <ShellContent  Route="AboutPage" ContentTemplate="{DataTemplate local:AboutPage}" />  
            </Tab>  
    </TabBar>  
    

    Best Regards,
    Wenyan Zhang


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  3. Laura 0 Reputation points
    2025-03-14T14:31:59.6866667+00:00

    I have a fresh new project with just a TabBar containing two Tabs in the Shell.

    IsEnabled="False" is not working for Tabs in Windows (It works in Android). IsVisible property is working fine.

    Using Maui 9.0.14, .net9

    Here is my AppShell.xaml:

    <Shell
        x:Class="TabErrorTest.AppShell"
        xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
        xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
        xmlns:local="clr-namespace:TabErrorTest"
        Shell.FlyoutBehavior="Disabled"
        Title="TabErrorTest">
    
    
        <TabBar >
            <Tab Title="Tab1" IsEnabled="False">
                <ShellContent
            Title="Content 1"
            ContentTemplate="{DataTemplate local:MainPage}"
            Route="MainPage1" />
            </Tab>
            <Tab Title="Tab2"
                  IsEnabled="False">
                <ShellContent
            Title="Content 2"
            IsEnabled="False"
            ContentTemplate="{DataTemplate local:MainPage}"
            Route="MainPage2" />
            </Tab>
        </TabBar>
    
    </Shell>
    
    

    Is there any workaround to this?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.