Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Hiding TabbedPage toolbaritems when listview item navigates to next page

$
0
0

Hi, How do i remove the toolbaritem when an item in a listview is clicked.
The tabbed page has the following code to display toolbaritems

var contactsPage = new NavigationPage (new ContactsTab () { 
                Title = "Contacts"
            }) 
            {
                Title = "Contacts",
                Icon="contacts_icon.png",
            };
            contactsPage.ToolbarItems.Add (new ToolbarItem ("Sign Out", "signout_icon.png", async () => {
                await Navigation.PopModalAsync ();
            }));
            this.Children.Add(contactsPage);

In the ContactsTab page, there is a listview with contacts and when clicked, it navigates to the profile page. But i want to remove the sign out toolbaritem when it navigates and redisplay it when the back button is pressed.

public async void OnListViewItemTapped(object sender, ItemTappedEventArgs e)
        {
            BasicContact profile = (BasicContact)e.Item;
            await Navigation.PushAsync(new ProfilePage (profile));
            ((ListView)sender).SelectedItem = null;
            FreeVariables.fv.isProfileOpen = true;
            // Remove ToolbarItem here or remove on Profile page OnAppearing event
        }

Any suggestions?


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>