2017-08-17 154 views
-1

我在Ios中有主详细信息页面,现在我需要在详细信息页面中显示一些值,当点击母版页中的按钮时。可以帮助我实现它。在Ios中的主详细信息页

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

https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/navigation/master-detail的价值-page/ –

回答

1

使用命令按钮和命令参数来传递你想显示详细信息页面

+0

欢迎使用stackoverflow!尽量避免回答评论,除非你有特定的答案。请使用下面的评论框,一旦你有足够的声誉,你将能够评论任何帖子。 :) –