Is it possible to use Expander in Shell Flyout?

Michael McGlothlin 26 Reputation points
2021-03-16T01:42:17.753+00:00

With Xamarin.Forms, is it possible to use Xamarin.CommunityToolkit.Expander inside a Shell Flyout menu? I seem to be able to put it in the FlyoutHeader but the Flyout closes when the Expander is tapped. It seems to work if I set the FlyoutBehavior to Locked but this obviously the has side effects.

If not currently possible, would IShellController.OnFlyoutItemSelectedAsync of the Shell class be the probable place triggering this to close?

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,298 questions
0 comments No comments
{count} vote

Accepted answer
  1. Cole Xia (Shanghai Wicresoft Co,.Ltd.) 6,751 Reputation points
    2021-03-16T03:27:44.117+00:00

    Hello,

    Welcome to Microsoft Q&A!

    Test with latest Xamarin.Forms(5.0.0.2012) , it works without problem , the Flyout menu does not close when tapping on the expander .

    Code
       <Shell.FlyoutHeader>  
               <xct:Expander>  
                   <xct:Expander.Header>  
                       <Label Text="Click to Expand" FontAttributes="Bold"  FontSize="Medium" />  
                   </xct:Expander.Header>  
                   <Grid Padding="10">  
                       <Grid.ColumnDefinitions>  
                           <ColumnDefinition Width="Auto" />  
                           <ColumnDefinition Width="Auto" />  
                       </Grid.ColumnDefinitions>  
                       <Image Source="xamarinstore.jpg"  
                      Aspect="AspectFill"  
                      HeightRequest="120"  
                      WidthRequest="120" />  
                       <Label Grid.Column="1"  
                      Text="Hello I'm Cole"  
                      FontAttributes="Italic" />  
                   </Grid>  
               </xct:Expander>  
           </Shell.FlyoutHeader>  
    
    Screen shot

    78101-capture.png 77947-2.png


    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 person found this answer helpful.

0 additional answers

Sort by: Most helpful