ohk*_*red 8 cross-platform master-detail right-to-left xamarin xamarin.forms
我使用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;
}
}
Run Code Online (Sandbox Code Playgroud)
这在控件集中不存在Xamarin.Forms
,但您可以创建自己的控件,并为每个平台提供渲染器。
您可以在http://developer.xamarin.com/guides/cross-platform/xamarin-forms/custom-renderer/上找到所需的信息
归档时间: |
|
查看次数: |
8463 次 |
最近记录: |