Xamarin.Forms: TabbedPage 中的按钮

Xamarin.Forms: Button in TabbedPage

如何使用此代码将按钮添加到其他页面(这是 TabbedPage 中一张卡片的一部分):

this.Children.Add(new ContentPage
        {
            Title = "Text",
            Content = new StackLayout
            {
                Padding = 20,
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children =
                {
                    new Image
                    {
                        Source = ImageSource.FromFile("image.png")
                    },
                    new Label
                    {
                        TextColor = Color.FromHex("#5F5A5A"),
                        FontSize = 16,
                        Text = "Other text"  
                    }
             }
            }
        });

感谢您的帮助。

如果我对您的问题的理解正确,您只需要在另一个选项卡中添加按钮?

this.Children.Add(new ContentPage
        {
            Title = "Text",
            Content = new StackLayout
            {
                Padding = 20,
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children =
                {
                    new Image
                    {
                        Source = ImageSource.FromFile("image.png")
                    },
                    new Label
                    {
                        TextColor = Color.FromHex("#5F5A5A"),
                        FontSize = 16,
                        Text = "Other text"  
                    }
             }
            }
        });
this.Children.Add(new ContentPage
        {
            Title = "Button",
            Content = new StackLayout
            {
Children ={
              new Button{
Image = ImageSource.FromFile("button.png"),
Backgroundcolor = "Transparent"

}
             }
            }
        });

或者您可以使用点击手势识别器

var button = new Image {  }; 
button.GestureRecognizers.Add (new TapGestureRecognizer (sender => {

}));