Share via

Shell FlyoutItem AsMultipleItems

2021-01-25T10:02:57.443+00:00

in my application I have roles and depending on the role it will have different menu options for example:

<FlyoutItem Route="AdminMain" FlyoutDisplayOptions="AsMultipleItems" IsTabStop="False" FlyoutItemIsVisible="{Binding IsVisibleAdmin}">
     <ShellContent Route="ManageUsersPage" ContentTemplate="{Local DataTemplate: ManageUsersPage}" Title="Manage Users" />
     ......Others
 </FlyoutItem>

 <FlyoutItem Route="EmployeAmin" FlyoutDisplayOptions="AsMultipleItems" IsTabStop="False" FlyoutItemIsVisible="{Binding IsVisibleEmploye}">
     <ShellContent Route="EmployePage" ContentTemplate="{Local DataTemplate: EmployePage}" Title="Employe" />
    ......Others
 </FlyoutItem>

then depending on the login and when I receive its role I navigate to the AdminMain or EmployeMain route, but I have to play with the IsVisibleAdmin or IsVisibleEmploye properties, is there another more efficient way?

Developer technologies | .NET | Xamarin
0 comments No comments

Answer accepted by question author

JarvanZhang 23,971 Reputation points
2021-01-25T11:45:55.113+00:00

Hello,​

Welcome to our Microsoft Q&A platform!

in my application I have roles and depending on the role it will have different menu options

You could create different shell templates for the roles. Detect the role when the user logins in to specify the MainPage.

   public LoginPage()  
   {  
       InitializeComponent();  
     
       if (Role is admin)  
       {  
           //navigate to the admin template  
           MainPage = new Admin_Shell();  
       }  
       else if (Role is EmployeAdmin)  
       {  
           //navigate to the employeAdmin template  
           MainPage = new EmployeAdmin_Shell();  
       }  
   }  

Best Regards,

Jarvan 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.

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

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