NavigationPage and ToolbarItems

I've been trying to get a couple of Forms pages set up under Android (for the moment, iOS to follow). The main page has a single ToolBarItem that is set to show the second page when clicked. When the toolbar button is clicked, the new page is shown, but the toolbar still shows the ToolBarItems from the first page, even if I call this.ToolbarItems.Clear(). The icons for the pages are also ignored (unless I put a call to NavigationPage.SetTitleIcon(this, this.Icon) in each page's constructor).

Is this expected behaviour?

Answers

  • TheRealJasonSmithTheRealJasonSmith USXamarin Team Xamurai

    It really doesn't sound like expected behavior. Can we get some sample code from you and we will suss it out?

  • TheRealJasonSmithTheRealJasonSmith USXamarin Team Xamurai

    Thank you, I will try to get to this tomorrow :)

  • EwanCunninghamEwanCunningham USMember ✭✭

    Thanks

  • DanielLDanielL PLInsider ✭✭✭✭
    edited June 2014

    I have the same problem. Is there any solution?

    Another strange thing is that Toolbar methods and properties aren't recognized by Xamarin Studio (they are marked as red) but the project builds without any errors. It's a SharedProject.

  • EwanCunninghamEwanCunningham USMember ✭✭

    Still seems to be broken in 1.0.6197, any news of when this will be fixed?

  • DanielLDanielL PLInsider ✭✭✭✭

    Tested 1.0.6197 - still broken

  • SamuelMcAraveySamuelMcAravey USMember

    One work around that I have found is to override the OnAppearing and OnDisappearing methods and add/remove the ToolbarItems. It seems to work on Windows Phone, but I'm having some issues trying to fire up the Android emulator to test it.

    protected override void OnAppearing()
    {
        this.ToolbarItems.Add(this.saveToolbarItem);
        this.ToolbarItems.Add(this.cancelToolbarItem);
    }
    
    protected override void OnDisappearing()
    {
        this.ToolbarItems.Clear();
    }
    
  • StephaneDelcroixStephaneDelcroix USInsider, Beta ✭✭✭✭

    I filed an issue so we investigate this.

  • StephaneDelcroixStephaneDelcroix USInsider, Beta ✭✭✭✭

    I can confirm this issue. thanks for the test case.

  • EwanCunninghamEwanCunningham USMember ✭✭

    I just checked with Forms 1.1.0 -- the toolbar issue has been fixed, thanks, but the icons still don't work with Android without the call to NavigationPage.SetTitleIcon (i.e. the main-page icon is shown on the second page).

  • TheRealJasonSmithTheRealJasonSmith USXamarin Team Xamurai

    @EwanCunningham‌ confirmed targeting for 1.1.1

  • EwanCunninghamEwanCunningham USMember ✭✭

    Thanks Jason

  • JacobHookomJacobHookom USMember

    In the NamedColorPage example with the master/detail, if you add the NavigationPage.SetTitleIcon(...) to the constructor, after initial load of the Aqua page, any subsequent selections will continue to show the customized title icon, but the title text binding will not get updated (blanks out and never updates).

  • How can I follow this BUG, is that any public tracker? I'm on version 1.2.2.0 and this issue persists.

    Tks

  • jameszhoujameszhou CNMember ✭✭

    @JasonASmith‌ is this bug tracked in your system? where can I check it status?

  • PaulReadPaulRead GBMember ✭✭

    Was it fixed?

  • shenghanshenghan MYMember
    edited June 2016

    Is this fixed? this.ToolbarItems.Clear() still does not seem to be working on Forms 2.2.031 and two years later.
    ToolBarItems from the main page are still observed to be present in subsequent child/detail pages.

  • AlisonFernandesAlisonFernandes USMember ✭✭

    Any news on this? In 2.0.5782, only using C# and in iOS, I'm able to change some item properties like text and see it reflected but, changing the ToolbarItems list doesn't have any impact on the UI after the view creation. Tried manually triggering a property changed with OnPropertyChanged(nameof(ToolbarItems)), to no avail.

  • DerProgrammiererDerProgrammierer DEMember ✭✭✭

    @TheRealJasonSmith hope you are fine, you haven't been active in the forums since May :open_mouth:

    There are still many problems with the Toolbar, especially in UWP. One of a few big problems I'm facing atm is this:

    https://forums.xamarin.com/discussion/comment/232600/#Comment_232600

    I know that UWP is not used as much as iOS and Android, but this bug is confirmed since over half a year now :confused:

  • AlejandroConsAlejandroCons USMember ✭✭

    I have the same issue, where subsequent navigation pages maintain the toolbaritems of the original.
    The bug mentioned: https://bugzilla.xamarin.com/show_bug.cgi?id=40073#c1
    is still confirmed with no progress.

    How come this is still an issue after more than 2 years of this being reported?

Sign In or Register to comment.