我在Ios中有Master Details页面,现在我需要在点击母版页中的按钮时在详细信息页面中显示一些值。可以帮助我实现它。
public class StoresTabletPage : MasterDetailPage
{
public StoresTabletPage()
{
Title = "Stores";
Detail = new ContentPage
{
IsVisible = true,
MinimumWidthRequest = 100,
Content = new StackLayout
{
VerticalOptions = LayoutOptions.Center,
HorizontalOptions = LayoutOptions.Center,
Children =
{
new Label { Text = "Label1", FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)) }
}
}
};
Master = new ContentPage
{
MinimumWidthRequest = 500,
Title = "string",
Content = new StackLayout
{
VerticalOptions = LayoutOptions.Center,
HorizontalOptions = LayoutOptions.Center,
Children =
{
new Button{ Text = "1", FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Button)) }
}
}
};
因此,当在母版页中单击按钮时,它应该在详细页面中显示label1。
答案 0 :(得分:1)
使用命令按钮和命令参数传递要在详细信息页面上显示的值