diff options
Diffstat (limited to 'Xamarin.Forms.Platform.MacOS/Controls/NavigationChildPageWrapper.cs')
-rw-r--r-- | Xamarin.Forms.Platform.MacOS/Controls/NavigationChildPageWrapper.cs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.MacOS/Controls/NavigationChildPageWrapper.cs b/Xamarin.Forms.Platform.MacOS/Controls/NavigationChildPageWrapper.cs new file mode 100644 index 00000000..a0e6dd41 --- /dev/null +++ b/Xamarin.Forms.Platform.MacOS/Controls/NavigationChildPageWrapper.cs @@ -0,0 +1,41 @@ +using System; +using Foundation; + +namespace Xamarin.Forms.Platform.MacOS +{ + internal class NavigationChildPageWrapper : NSObject + { + bool _disposed; + + public NavigationChildPageWrapper(Page page) + { + Page = page; + Page.PropertyChanged += PagePropertyChanged; + Identifier = Guid.NewGuid().ToString(); + } + + protected override void Dispose(bool disposing) + { + if (disposing && !_disposed) + { + _disposed = true; + if (Page != null) + Page.PropertyChanged -= PagePropertyChanged; + Page = null; + } + base.Dispose(disposing); + } + + void PagePropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) + { + if (e.PropertyName == NavigationPage.HasNavigationBarProperty.PropertyName + || e.PropertyName == Page.TitleProperty.PropertyName + || e.PropertyName == NavigationPage.HasBackButtonProperty.PropertyName) + Platform.NativeToolbarTracker.UpdateToolBar(); + } + + public string Identifier { get; set; } + + public Page Page { get; private set; } + } +}
\ No newline at end of file |