Master Detail Page on the right side using Xamarin.Forms

冷暖自知 提交于 2019-12-05 22:00:37

问题


I've created a master detail page on the left side using Xamarin.Forms, how about creating the same for the right side?

Below is my sample code for the left slider menu;

public class App
{
    static MasterDetailPage MDPage;

    public static Page GetMainPage()
    {
        return MDPage = new MasterDetailPage {
            Master = new ContentPage {
                Title = "Master",
                BackgroundColor = Color.Silver,
                Icon = Device.OS == TargetPlatform.iOS ? "menu.png" : null,
                Content = new StackLayout {
                    Padding = new Thickness(5, 50),
                    Children = { Link("A"), Link("B"), Link("C") }
                },
            },
            Detail = new NavigationPage(new ContentPage {
                Title = "A",
                Content = new Label { Text = "A" }
            }),
        };
    }

    static Button Link(string name)
    {
        var button = new Button {
            Text = name,
            BackgroundColor = Color.FromRgb(0.9, 0.9, 0.9)
        };
        button.Clicked += delegate {
            MDPage.Detail = new NavigationPage(new ContentPage {
                Title = name,
                Content = new Label { Text = name }
            });
            MDPage.IsPresented = false;
        };
        return button;
    }
}

回答1:


This does not exists in the Xamarin.Forms controls set, but you can create your own, with renderers for each platform.

You'll find the required information on http://developer.xamarin.com/guides/cross-platform/xamarin-forms/custom-renderer/




回答2:


Solution here

this is now supported in xamarin forms 3.0 and up, NO custom renderers needed !! or third party libraries.

the trick is to force the layout to RTL, while flow direction works, its hard to make the top nav bar to follow, below is the solution for that problem, it works... let me know if you face any issues on older ios versions IOS8 and less.

xamarin forms RTL master details page with icon RTL/LTR hamburger




回答3:


You can make it by ToolbarItems in Xamarin Forms ToolbarItems will appear in right side.

You can find more info from the following links : http://codeworks.it/blog/?p=232



来源:https://stackoverflow.com/questions/25841869/master-detail-page-on-the-right-side-using-xamarin-forms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!