0

How to add button to other page on this code (this is part of one card in 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"  
                    }
             }
            }
        });

Thanks for help.

1 Answers1

0

If I understood your issue right, you just need button in another tab?

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"

}
             }
            }
        });

Alternatively you can use tap gesture recognizer

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

}));
Marvin Dickhaus
  • 785
  • 12
  • 27
Artem Zelinskiy
  • 2,201
  • 16
  • 19