【问题标题】:Master Detail Page on the right side using Xamarin.Forms右侧使用 Xamarin.Forms 的主详细信息页面
【发布时间】:2014-11-08 14:45:40
【问题描述】:

我使用 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;
    }
}

【问题讨论】:

  • 你找到解决方法了吗?

标签: xamarin xamarin.forms cross-platform right-to-left master-detail


【解决方案1】:

这在Xamarin.Forms 控件集中不存在,但您可以创建自己的,为每个平台使用渲染器。

您可以在http://developer.xamarin.com/guides/cross-platform/xamarin-forms/custom-renderer/找到所需的信息

【讨论】:

    【解决方案2】:

    解决办法

    现在 xamarin forms 3.0 及更高版本支持此功能,没有自定义渲染器 需要!!或第三方库。

    诀窍是强制布局为 RTL, 虽然流向有效,但很难让顶部导航栏跟随, 以下是该问题的解决方案,它有效...如果您在旧 ios 版本 IOS8 及更低版本上遇到任何问题,请告诉我。

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

    【讨论】:

      【解决方案3】:

      你可以通过ToolbarItems in Xamarin Forms ToolbarItems 将出现在右侧。

      您可以从以下链接中找到更多信息: http://codeworks.it/blog/?p=232

      【讨论】:

        猜你喜欢
        • 2016-09-20
        • 1970-01-01
        • 2020-11-01
        • 1970-01-01
        • 1970-01-01
        • 2019-08-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多