使用Xamarin.Forms在右侧创建主细节页面

9
我使用Xamarin.Forms创建了一个主从页面,如何在右侧创建相同的页面?
以下是我左侧滑动菜单的示例代码:
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;
    }
}

你找到解决方法了吗? - Pooran
3个回答

2

0
解决方案在这里

现在在 Xamarin Forms 3.0 及以上版本中支持此功能,不需要自定义渲染器或第三方库。

关键是强制布局为 RTL(从右到左),虽然流动方向可以工作,但很难让顶部导航栏遵循其方向。以下是解决该问题的方法,它有效... 如果您在旧的 iOS 版本 IOS8 及更低版本上遇到任何问题,请告诉我。

带有图标 RTL/LTR 汉堡菜单的 Xamarin Forms RTL 主细节页面


-2

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接