Xamarin.Forms FlyoutPage FlowDirection RightToLeft

Pelin Konaray 291 Reputation points
2021-11-04T06:10:37.623+00:00

I have an app it used Xamarin.Forms FlyoutPage. It is designed to open from left side. But I also want to support the Arabic language now. That's why I want to open it from right side.
I added FlowDirection="RightToLeft" to FlyoutPage. It made aligned to right side the all text. But the side menu has not been changed to open from the right side. I applied this right to left localization steps And I also changed localization settings of test devices. None of them could not changed flyout direction as right to left.

I also added following codes to xaml.cs of Flyout page. But it didn't work.

Flyout.FlowDirection = FlowDirection.RightToLeft;
Detail.FlowDirection = FlowDirection.RightToLeft;

I have seen Xamarin.Forms Shell flyout. And I tried it with an sample project. FlowDirection="RightToLeft" command works with shell. But it will take me a lot of time to turn it into shell. (Because my app has lots of page and my all navigation will change when i change it.)

That's why I am trying to find a way to rotate side menu as right to left with Xamarin.Forms FlyoutPage. How can I do it?

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

Accepted answer
  1. JarvanZhang 23,951 Reputation points
    2021-11-05T02:15:21.02+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    To display the FlyoutPage on the right side, please set FlowDirection to RightToLeft for the flyoutPage.

       <FlyoutPage ...  
               FlowDirection="RightToLeft">  
             
           <FlyoutPage.Flyout>  
               <pages:FlyoutPageFlyout x:Name="FlyoutPage" />  
           </FlyoutPage.Flyout>  
           <FlyoutPage.Detail>  
               <NavigationPage>  
                   <x:Arguments>  
                       <pages:FlyoutPageDetail />  
                   </x:Arguments>  
               </NavigationPage>  
           </FlyoutPage.Detail>  
       </FlyoutPage>  
    

    On Android, we also need to set android:supportsRtl to ture in AndroidManifest.xml to enable the function.

       <manifest ...>  
         <application android:theme="@style/MainTheme" android:supportsRtl="true"></application>  
       </manifest>  
    

    Here is the related doc, you could refer it.
    https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/localization/right-to-left

    Best Regards,

    Jarvan Zhang


    If the response is helpful, 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.


0 additional answers

Sort by: Most helpful