[GTK] Fix navigation (#6692)
authornels83 <nels+git@pgroupe.net>
Wed, 3 Jul 2019 22:59:37 +0000 (00:59 +0200)
committerSamantha Houts <samhouts@users.noreply.github.com>
Wed, 3 Jul 2019 22:59:37 +0000 (15:59 -0700)
Commit 491947606d03647124bffffcea8547e135869027
introduced this change :

* [GTK] Don't recreate the toolbar on each change

However when changing page, toolbar needs to be recreated.

Xamarin.Forms.Platform.GTK/GtkToolbarTracker.cs
Xamarin.Forms.Platform.GTK/Renderers/NavigationPageRenderer.cs

index 829786e..af3938c 100644 (file)
@@ -395,6 +395,11 @@ namespace Xamarin.Forms.Platform.GTK
                        }
                }
 
+               internal void ResetToolBar()
+               {
+                       _toolbar = null;
+               }
+
                private void OnToolbarItemPropertyChanged(object sender, PropertyChangedEventArgs e)
                {
                        if (e.PropertyName == MenuItem.IsEnabledProperty.PropertyName)
index c30d8ea..67884ea 100644 (file)
@@ -248,6 +248,10 @@ namespace Xamarin.Forms.Platform.GTK.Renderers
                        if (_currentPage != null)
                        {
                                _currentPage.PropertyChanged += OnCurrentPagePropertyChanged;
+                               if (_toolbarTracker != null)
+                               {
+                                       _toolbarTracker.ResetToolBar();
+                               }
                        }
 
                        UpdateTitle();