Sliding drawer is open from right to left in xamarin android

I'm having a problem opening a sliding drawer from right to left for a hamarin android. but below code that works to show the slide.

box from left to right. if any property MasterDetailPage open sliding from right to left please share your views with me. Here the sliding box is open from left to right, but I want to open from right to left for Xamarin Android Any idea on this. please share your idea. We also use MenuRootPage to add items to the sliding box:

Code for items view: 
  <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" > <ContentPage.Content> <StackLayout BackgroundColor="{StaticResource ToolbarStatusBackgroundColor}" Orientation="Vertical" Spacing="20"> <StackLayout> <StackLayout.GestureRecognizers> <TapGestureRecognizer Command="{mm:Command SliderClose}" /> </StackLayout.GestureRecognizers> <Image Source="menu.png" HorizontalOptions="Start" Margin="10,40,0,0" /> </StackLayout> <BoxView HorizontalOptions="EndAndExpand" HeightRequest="1" WidthRequest="1000" Color="{StaticResource SeparatorColor}" /> <Label Text="My account" Style="{StaticResource ToolbarStatusDescriptionLabel}" Margin="10" > <Label.GestureRecognizers> <TapGestureRecognizer Command="{mm:Command SliderClose}" /> </Label.GestureRecognizers> </Label> <BoxView HorizontalOptions="EndAndExpand" HeightRequest="1" WidthRequest="1000" Color="{StaticResource SeparatorColor}" /> <Label Text="Settings" Style="{StaticResource ToolbarStatusDescriptionLabel}" Margin="10"> <Label.GestureRecognizers> <TapGestureRecognizer Command="{mm:Command SliderClose}" /> </Label.GestureRecognizers> </Label> <BoxView HorizontalOptions="EndAndExpand" HeightRequest="1" WidthRequest="1000" Color="{StaticResource SeparatorColor}" /> <Label Text="Logout" Style="{StaticResource ToolbarStatusDescriptionLabel}" HorizontalTextAlignment="Center" VerticalOptions="EndAndExpand" Margin="10"> <Label.GestureRecognizers> <TapGestureRecognizer Command="{mm:Command Logout}" /> </Label.GestureRecognizers> </Label> </StackLayout> </ContentPage.Content> </ContentPage> In MenuRootPage .xaml file we are declare master page only UI section In MenuRootPage .cs file: here we are inherit MasterDetailPage properties Using code: Root page in MenuRootPage .xaml file: <MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Ansible.Vektor.App.Shared.Views.MenuRootPage" > </MasterDetailPage> Root MenuRootPage .cs file: public partial class MenuRootPage : MasterDetailPage { public MenuRootPage () { InitializeComponent(); MasterBehavior = MasterBehavior.Popover; } } App.xaml.cs: var menuPage = new MenuPages() { BindingContext = MenuPagesViewModel }; NavigationPage = new NavigationPage(new MainView() { BindingContext = MainViewModel }); MenuRootPage = new MenuRootPage(); MenuRootPage.Master = menuPage; MenuRootPage.Detail = NavigationPage; MenuIsGestureEnabled = false; MainPage = MenuRootPage; Here Sliding Drawer open from left to right but i want to open from right to left for Xamarin Android Any idea regarding this. please share your idea's. 
+5
source share
1 answer

Create a personalized render for the Android drillthrough homepage.

 public class MyMasterDetailPageRenderer : MasterDetailPageRenderer { protected override void OnElementChanged(VisualElement oldElement, VisualElement newElement) { base.OnElementChanged(oldElement, newElement); var fieldInfo = GetType().BaseType.GetField("_masterLayout", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); var _masterLayout = (ViewGroup)fieldInfo.GetValue(this); var lp = new DrawerLayout.LayoutParams(_masterLayout.LayoutParameters); lp.Width = 300; lp.Gravity = (int)GravityFlags.Right; _masterLayout.LayoutParameters = lp; } } 
+3
source

Source: https://habr.com/ru/post/1275620/


All Articles