Maui FlyoutPage application issue

Haviv Elbsz 1,471 Reputation points

Hi all

I follow the maui doc topic flyoutpage app
and there's said that this type of application
don't works with Maui shell.


FlyoutPage is incompatible with .NET MAUI Shell apps, and an exception will be thrown if you attempt to use FlyoutPage in a Shell app. For more information about Shell apps, see Shell

Do Microsoft itself know how to do that.
Because the doc is very confusing.

but when I create a Maui app there's building
also a shell codes.

so how I get rid of that codes

or how I build a flyoutpage project
without a maui shell.

Thank you very much.

A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,214 questions
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,508 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 25,286 Reputation points Microsoft Vendor


    You need to delete AppShell at first, if you want to use flyoutpage in your applicaiton.

    Both FlyoutPage and Shell contain Flyout controls, so the two are not compatible.

    You could refer to this official sample to learn how to create a FlyoutPage app: FlyoutPageSample.


    Step1. Create a .Net MAUI App.

    Step2. Delete AppShell.xaml from the project.

    Step3. Create the FlyoutPageItem class as the documentation.

    Step4. Create a .Net MAUI ContentPage(XAML) type page, and name it MyFlyoutPage.xaml.

    Step5. Add xmlns:local="clr-namespace:You_Project_Page_NameSpace" into MyFlyoutPage.xaml and modify ContentPage to FlyoutPage in MyFlyoutPage.xaml and MyFlyoutPage.xaml.cs.

    Step6. Create .Net MAUI ContentPage(XAML) type pages: FlyoutMenuPage.xaml, NewPage1 and NewPage2.

    Step7. Add xmlns:local="clr-namespace:You_Project_Page_NameSpace" into FlyoutMenuPage.xaml

    Step8. Add the following code into your MyFlyoutPage.xaml

               <local:FlyoutMenuPage x:Name="flyoutPage" />  
                       <local:MainPage />  

    Step9. Add the SelectionChanged event into MyFlyoutPage.xaml.cs as the documentation.

    Step10. In the FlyoutMenuPage.xaml, please copy the following code into it:

       <CollectionView x:Name="collectionView"  
               <x:Array Type="{x:Type local:FlyoutPageItem}">  
                   <local:FlyoutPageItem Title="Contacts"  
                                             TargetType="{x:Type local:NewPage1}" />  
                   <local:FlyoutPageItem Title="TodoList"  
                                             TargetType="{x:Type local:NewPage2}" />  
                   <Grid Padding="5,10">  
                           <ColumnDefinition Width="30"/>  
                           <ColumnDefinition Width="*" />  
                       <Image Source="{Binding IconSource}" />  
                       <Label Grid.Column="1"  
                                  Text="{Binding Title}"  
                                  VerticalOptions="Center" />  

    Step11. Open the App.xaml.cs file, and modify MainPage = new AppShell(); to MainPage = new MyFlyoutPage();.

    Then, you could build your first MAUI FlyoutPage App.

    Best Regards,

    Alec Liu.

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    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.