Skip to content

Commit

Permalink
Merge pull request muak#12 from muak/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
muak authored Jun 6, 2020
2 parents 397c754 + 96e9558 commit 7ef8672
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 6 deletions.
5 changes: 4 additions & 1 deletion AiForms.Dialogs.Android/DialogImplementation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ public IReusableDialog Create<TView>(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);
}

Expand Down
5 changes: 4 additions & 1 deletion AiForms.Dialogs.Android/LoadingImplementation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ public IReusableLoading Create<TView>(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);
}

Expand Down
5 changes: 4 additions & 1 deletion AiForms.Dialogs.Android/ToastImplementation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ public void Show<TView>(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);

Expand Down
5 changes: 4 additions & 1 deletion AiForms.Dialogs.iOS/DialogImplementation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ public IReusableDialog Create<TView>(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);
}

Expand Down
5 changes: 4 additions & 1 deletion AiForms.Dialogs.iOS/LoadingImplementation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ public IReusableLoading Create<TView>(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);
}

Expand Down
5 changes: 4 additions & 1 deletion AiForms.Dialogs.iOS/ToastImplementation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ public void Show<TView>(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);
Expand Down
1 change: 1 addition & 0 deletions nuget/AzurePipelines.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<releaseNotes>
## Changes

* [All] If a ViewModel is specified to null, View's BindingContext is not now overwritten.
* [Dialog][Android] Nested dialogs are now supported. #8
</releaseNotes>
<tags>Xamarin.Forms Xamarin dialog toast loading progress popup xaml netstandard ios android</tags>
Expand Down

0 comments on commit 7ef8672

Please sign in to comment.