From 53e1d99a751e7a9cb8ae3f67ac8f3630b2aea398 Mon Sep 17 00:00:00 2001 From: "E.Z. Hart" Date: Tue, 27 Sep 2016 07:50:02 -0600 Subject: Fix potential NRE accessing current application via Page.RealParent (#330) * Fix potential NRE accessing current application via Page.RealParent * Update Native Bindings Gallery to use MessagingCenter --- .../ControlGalleryPages/NativeBindingGalleryPage.cs | 8 ++++++++ .../ControlGalleryPages/NestedNativeControlGalleryPage.cs | 8 ++++++++ 2 files changed, 16 insertions(+) (limited to 'Xamarin.Forms.Controls') diff --git a/Xamarin.Forms.Controls/ControlGalleryPages/NativeBindingGalleryPage.cs b/Xamarin.Forms.Controls/ControlGalleryPages/NativeBindingGalleryPage.cs index 51d9b970..2941b4bb 100644 --- a/Xamarin.Forms.Controls/ControlGalleryPages/NativeBindingGalleryPage.cs +++ b/Xamarin.Forms.Controls/ControlGalleryPages/NativeBindingGalleryPage.cs @@ -10,6 +10,14 @@ namespace Xamarin.Forms.Controls NestedNativeViewModel ViewModel { get; set; } + public const string ReadyForNativeBindingsMessage = "ReadyForNativeBindings"; + + protected override void OnAppearing() + { + base.OnAppearing(); + MessagingCenter.Send(this, ReadyForNativeBindingsMessage); + } + public NativeBindingGalleryPage() { diff --git a/Xamarin.Forms.Controls/ControlGalleryPages/NestedNativeControlGalleryPage.cs b/Xamarin.Forms.Controls/ControlGalleryPages/NestedNativeControlGalleryPage.cs index 9f596601..d93d2d66 100644 --- a/Xamarin.Forms.Controls/ControlGalleryPages/NestedNativeControlGalleryPage.cs +++ b/Xamarin.Forms.Controls/ControlGalleryPages/NestedNativeControlGalleryPage.cs @@ -6,6 +6,14 @@ namespace Xamarin.Forms.Controls public bool NativeControlsAdded { get; set; } + public const string ReadyForNativeControlsMessage = "ReadyForNativeControls"; + + protected override void OnAppearing() + { + base.OnAppearing(); + MessagingCenter.Send(this, ReadyForNativeControlsMessage); + } + public NestedNativeControlGalleryPage () { Layout = new StackLayout { Padding = 20, VerticalOptions = LayoutOptions.FillAndExpand }; -- cgit v1.2.3