diff --git a/AiForms.Dialogs.Android/DialogImplementation.cs b/AiForms.Dialogs.Android/DialogImplementation.cs index ef4a187..6b6ccbf 100644 --- a/AiForms.Dialogs.Android/DialogImplementation.cs +++ b/AiForms.Dialogs.Android/DialogImplementation.cs @@ -19,7 +19,10 @@ public IReusableDialog Create(object viewModel = null) where TView : Dial public IReusableDialog Create(DialogView view, object viewModel = null) { - view.BindingContext = viewModel; + if (viewModel != null) + { + view.BindingContext = viewModel; + } return new ReusableDialog(view); } diff --git a/AiForms.Dialogs.Android/LoadingImplementation.cs b/AiForms.Dialogs.Android/LoadingImplementation.cs index d4e1413..5cf2e20 100644 --- a/AiForms.Dialogs.Android/LoadingImplementation.cs +++ b/AiForms.Dialogs.Android/LoadingImplementation.cs @@ -33,7 +33,10 @@ public IReusableLoading Create(object viewModel = null) where TView : Loa public IReusableLoading Create(LoadingView view, object viewModel = null) { - view.BindingContext = viewModel; + if(viewModel != null) + { + view.BindingContext = viewModel; + } return new ReusableLoading(view,LoadingDialog); } diff --git a/AiForms.Dialogs.Android/ToastImplementation.cs b/AiForms.Dialogs.Android/ToastImplementation.cs index e5c5c59..4f3fe82 100644 --- a/AiForms.Dialogs.Android/ToastImplementation.cs +++ b/AiForms.Dialogs.Android/ToastImplementation.cs @@ -26,7 +26,10 @@ public void Show(object viewModel = null) where TView : ToastView public void Show(ToastView view, object viewModel = null) { view.Parent = XF.Application.Current.MainPage; - view.BindingContext = viewModel; + if(viewModel != null) + { + view.BindingContext = viewModel; + } var toast = new Android.Widget.Toast(Dialogs.Context); diff --git a/AiForms.Dialogs.iOS/DialogImplementation.cs b/AiForms.Dialogs.iOS/DialogImplementation.cs index 9d243df..3e83600 100644 --- a/AiForms.Dialogs.iOS/DialogImplementation.cs +++ b/AiForms.Dialogs.iOS/DialogImplementation.cs @@ -21,7 +21,10 @@ public IReusableDialog Create(object viewModel = null) where TView : Dial public IReusableDialog Create(DialogView view, object viewModel = null) { - view.BindingContext = viewModel; + if(viewModel != null) + { + view.BindingContext = viewModel; + } return new ReusableDialog(view); } diff --git a/AiForms.Dialogs.iOS/LoadingImplementation.cs b/AiForms.Dialogs.iOS/LoadingImplementation.cs index 11e2ebc..c1813f0 100644 --- a/AiForms.Dialogs.iOS/LoadingImplementation.cs +++ b/AiForms.Dialogs.iOS/LoadingImplementation.cs @@ -32,7 +32,10 @@ public IReusableLoading Create(object viewModel = null) where TView : Loa public IReusableLoading Create(LoadingView view, object viewModel = null) { - view.BindingContext = viewModel; + if(viewModel != null) + { + view.BindingContext = viewModel; + } return new ReusableLoading(view); } diff --git a/AiForms.Dialogs.iOS/ToastImplementation.cs b/AiForms.Dialogs.iOS/ToastImplementation.cs index baa58b1..fb28f47 100644 --- a/AiForms.Dialogs.iOS/ToastImplementation.cs +++ b/AiForms.Dialogs.iOS/ToastImplementation.cs @@ -21,7 +21,10 @@ public void Show(object viewModel = null) where TView : ToastView public void Show(ToastView view, object viewModel = null) { - view.BindingContext = viewModel; + if(viewModel != null) + { + view.BindingContext = viewModel; + } view.Parent = Application.Current.MainPage; var renderer = Dialogs.CreateNativeView(view); diff --git a/nuget/AzurePipelines.nuspec b/nuget/AzurePipelines.nuspec index 396df21..dc0f264 100644 --- a/nuget/AzurePipelines.nuspec +++ b/nuget/AzurePipelines.nuspec @@ -16,6 +16,7 @@ ## Changes +* [All] If a ViewModel is specified to null, View's BindingContext is not now overwritten. * [Dialog][Android] Nested dialogs are now supported. #8 Xamarin.Forms Xamarin dialog toast loading progress popup xaml netstandard ios android