Use the OnAppaering() method inside a ContentView

Stefano M 91 Reputation points
2021-04-12T21:10:32.44+00:00

I am trying to implement a TabView. As the content of each Item I inserted pages that I had previously created, transforming them from ContentPage to ContentView. By doing this, however, it is no longer possible to use the override of the OnAppaering() and OnBackButtonPressed() methods. Is there a way to use these two methods within the ContentView?

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,293 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. JarvanZhang 23,936 Reputation points
    2021-04-13T06:18:38.383+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    The ContentView doesn't have the lifecycle events. Did you use Xamarin.Community.Toolkit.TabView to display the views? To detect the lifecycle events, try using contentPages instead and using Shell to for the template.

    Here is a similar issue case that may help you.
    https://learn.microsoft.com/en-us/answers/questions/170862/xamarin-bottom-custom-tab-bar.html

    Best Regards,

    Jarvan Zhang


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments