diff --git a/src/Uno.Toolkit.UI/Controls/NavigationBar/NativeFramePresenter.Android.cs b/src/Uno.Toolkit.UI/Controls/NavigationBar/NativeFramePresenter.Android.cs index 20d5a793e..2ac1e10e3 100644 --- a/src/Uno.Toolkit.UI/Controls/NavigationBar/NativeFramePresenter.Android.cs +++ b/src/Uno.Toolkit.UI/Controls/NavigationBar/NativeFramePresenter.Android.cs @@ -45,12 +45,13 @@ public partial class NativeFramePresenter : Grid // Inheriting from Grid is a ha public NativeFramePresenter() { _pageStack = this; + + this.Loaded += OnLoaded; } - protected override void OnTemplatedParentChanged(DependencyPropertyChangedEventArgs e) + private void OnLoaded(object sender, RoutedEventArgs e) { - base.OnTemplatedParentChanged(e); - Initialize(TemplatedParent as Frame); + Initialize(this.FindFirstParent()); } private void Initialize(Frame? frame) diff --git a/src/Uno.Toolkit.UI/Controls/NavigationBar/NativeFramePresenter.iOS.cs b/src/Uno.Toolkit.UI/Controls/NavigationBar/NativeFramePresenter.iOS.cs index 4bac0d3ae..6f022121d 100644 --- a/src/Uno.Toolkit.UI/Controls/NavigationBar/NativeFramePresenter.iOS.cs +++ b/src/Uno.Toolkit.UI/Controls/NavigationBar/NativeFramePresenter.iOS.cs @@ -107,12 +107,12 @@ public NativeFramePresenter() SizeChanged += NativeFramePresenter_SizeChanged; // Hide the NavigationBar by default. Only show if navigating to a Page that contains a NavigationBar. NavigationController.NavigationBarHidden = true; + this.Loaded += OnLoaded; } - protected override void OnTemplatedParentChanged(DependencyPropertyChangedEventArgs e) + private void OnLoaded(object sender, RoutedEventArgs e) { - base.OnTemplatedParentChanged(e); - InitializeController(TemplatedParent as Frame); + InitializeController(this.FindFirstParent()); } ///