0
votes

I have a problem. I want to load a TabbedPage when I click on a button in a different page, so I created this code:

protected void imgAdd_Clicked(object sender, EventArgs args)
{
    var tabbedPage = new TabbedPage();
    tabbedPage.Children.Add(new Page1());
    tabbedPage.Children.Add(new Page2());

    App.Current.MainPage = tabbedPage;
}

But the result is as follows: enter image description here

As you can see the Image leaves a trail of the image when you swipe between the pages.

However, when I load the Tabbed Page using the App.xaml.cs it loads correctly without the flickering, so it seems to only occur when I call the tabbed page from another page...

Any ideas?

2
First of all , remove this line: App.Current.MainPage = new TabbedPage(); Not sure,may be this is the culpritbhavya joshi
Removed it, but still same result!A. Vreeswijk
Show us Page1 and Page2 . Are the images you are using big in size ? use small images and check againbhavya joshi
Still no luck!!A. Vreeswijk
I make the sample to test, do not reproduce the error. Maybe i miss something, you could check the sample TabbedPageDemo on my github with 3.gif.github.com/WendyZang/TestWendy Zang - MSFT

2 Answers

0
votes

I make the sample to test. You could check the sample TabbedPageDemo on my github. https://github.com/WendyZang/Test.git

Create two pages.

Page1.xaml:

<StackLayout >
        <Image Source="pig.jpg"></Image>
    </StackLayout>

Page2.xaml:

<StackLayout>
        <Image Source="world.jpg"></Image>
    </StackLayout>

With the code you provided.

  var tabbedPage = new TabbedPage();
        tabbedPage.Children.Add(new Page1());
        tabbedPage.Children.Add(new Page2());
 App.Current.MainPage = tabbedPage;

Result:

enter image description here

-1
votes

Need more explanation about the issue,

The tabs in the Tabbedpage are dynamically created?

Suggestion: Use https://help.syncfusion.com/xamarin/tabbed-view/getting-started

it will save your time.