0
votes

I am using Rg.Plugins.Popup Nuget for showing a popup. My doubt is how can I call a popuppage from viewmodel class? I am using the following code in viewmodel.

  var page = new Pages.MyPopUpImage();
  await PopupNavigation.Instance.PushAsync(page);

Getting MissingMethodException when running the project. Also not working in xaml.cs class, getting the same exception there.

[0:] Exception:>>System.MissingMethodException: Method 'Xamarin.Forms.Platform.Android.Platform.CreateRendererWithContext' not found.
at Rg.Plugins.Popup.Droid.Impl.PopupPlatformDroid+<AddAsync>d__11.MoveNext () [0x0002c] in C:\projects\rg-plugins-popup\src\Rg.Plugins.Popup.Droid\Impl\PopupPlatformDroid.cs:45 
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <896ad1d315ca4ba7b117efb8dacaedcf>:0 
 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <896ad1d315ca4ba7b117efb8dacaedcf>:0 
 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <896ad1d315ca4ba7b117efb8dacaedcf>:0 
 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <896ad1d315ca4ba7b117efb8dacaedcf>:0 
at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0 
at Rg.Plugins.Popup.Services.PopupNavigationImpl+<AddAsync>d__11.MoveNext () [0x00039] in C:\projects\rg-plugins-popup\src\Rg.Plugins.Popup\Services\PopupNavigationImpl.cs:111 

Thanks in advance

1

1 Answers

1
votes
.. how can I call a popuppage from viewmodel class?

One option is to pass Navigation from your Page to the ViewModel. There are multiple ways how to do it, one quick and dirty way will be to pass it via constructor for example and then it will be easy to open a popup:

await Navigation.PushPopupAsync(new MyPopUpPage());

P.S.: System.MissingMethodException can be a cause of missing initialization & might be that this issue is related.

P.S.S: Try to delete bin & obj directories and rebuild + make sure that you have only one version of NuGet package installed.