使用Xamarin.Forms在右侧的Master Detail Page [英] Master Detail Page on the right side using Xamarin.Forms
本文介绍了使用Xamarin.Forms在右侧的Master Detail Page的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经使用Xamarin.Forms在左侧创建了一个主详细信息页面,如何在右侧创建一个详细信息页面?
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;
}
}
推荐答案
在Xamarin.Forms
控件集中不存在此功能,但是您可以使用每个平台的渲染器创建自己的控件.
This does not exists in the Xamarin.Forms
controls set, but you can create your own, with renderers for each platform.
您可以在 http:/上找到所需的信息. /developer.xamarin.com/guides/cross-platform/xamarin-forms/custom-renderer/
这篇关于使用Xamarin.Forms在右侧的Master Detail Page的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文