Opening Popup using IPopupService in v2 following documentation throws error #2786
-
I'm implementing popups using CommunityToolkit.Maui version 12 following Microsoft documentation at https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/views/popup-service#presenting-a-popup In the article, to open the popup, we use the following command which points to the view model for the popup: If I do this, I get the following error:
If I use the actual popup Is this an error in the documentation or am I missing something here? Here's a link to my public repo where you can see the code that throws the above mentioned error. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
You nust first register the popup with PopupService: https://learn.microsoft.com/dotnet/communitytoolkit/maui/views/popup-service: builder.Services.AddTransientPopup<NamePopup, NamePopupViewModel>(); |
Beta Was this translation helpful? Give feedback.
-
There is a very subtle difference between the documentation and your sample. You are calling builder.Services.AddTransient... Where the documentation states you should be calling builder.Services.AddTransientPopup... |
Beta Was this translation helpful? Give feedback.
You nust first register the popup with PopupService: https://learn.microsoft.com/dotnet/communitytoolkit/maui/views/popup-service: