Master-Detail Menu does not disappear if clicking outside on Android Tablet

Zoli 41 Reputation points
2022-01-18T08:48:28.087+00:00

Hi,

This only happens on Android Tablet, and works fine on Andoid Phone and iOS Phone+Tablet.
I already reported this to Xamarin, see here the details: https://github.com/xamarin/Xamarin.Forms/issues/15065

Has anyone any idea where to look for a workaroud?

Thanks

Developer technologies | .NET | Xamarin
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2022-01-19T07:00:54.857+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    Has anyone any idea where to look for a workaroud?

    Here is a workaround. You can monitor the touchevent for your MasterDetailPage in custom renderer, when click it, close your Master-Detail Menu.

    By the way, MasterDetailPage is obsolete as of version 5.0.0. Please use FlyoutPage instead.

       [assembly: ExportRenderer(typeof(MasterDetailPage), typeof(MyMasterDetailPageRenderer))]  
         
       namespace NavigationDrawerDemo.Droid  
       {  
           internal class MyMasterDetailPageRenderer : MasterDetailPageRenderer  
           {  
               public MyMasterDetailPageRenderer(Context context) : base(context)  
               {  
               }  
         
               public override bool OnTouchEvent(Android.Views.MotionEvent e)  
               {  
                   if (e.Action == Android.Views.MotionEventActions.Up)  
                       new Task(CloseDrawers).Start(TaskScheduler.FromCurrentSynchronizationContext());  
         
                   return base.OnTouchEvent(e);  
               }  
           }  
    

    Best Regards,

    Leon Lu


    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.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

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