question

Dave-1212 avatar image
0 Votes"
Dave-1212 asked WenyanZhang-MSFT commented

IsEnabled property doesn't seem to work for AppShell

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?


dotnet-xamarin
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Would you mind sharing more detail information about this issue? Do you use Flyout or Tabs ? By the way, which platform have you tested ? Do you use Shell in UWP?


0 Votes 0 ·

I am using Flyout although Flyout and TabBar make no difference for what I describe.
I
I tested both on Android and UWP and the IsEnabled property has no effect at all.


With IsEnabled, I wanted to disable user interaction of TabBar items until login was done but IsEnabled has no effect.

0 Votes 0 ·

May I know if you have got any chance to check my answer? I am glad to help if you have any other questions.

0 Votes 0 ·
WenyanZhang-MSFT avatar image
0 Votes"
WenyanZhang-MSFT answered GaryLewis-9102 commented

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.


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Wenyan is correct. I use this approach to differentiate between the "Standard" and "Pro" versions of my application. Certain Tabs are disabled in the standard version and enabled in the pro version.

1 Vote 1 ·
GerritOehlmann-3248 avatar image
0 Votes"
GerritOehlmann-3248 answered

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.