Popup V2 return data #2699
-
From https://github.com/CommunityToolkit/Maui/wiki/Migrating-to-Popup-v2#popupoptions I read: Removed the need to subclass Popup To return data I need to inherit from Popup<TData> but how can I specify in xaml that the base class is Popup<T> and not Popup? I tried to specify, for example, x:TypeArguments but I got "Partial declarations of 'MyPopupView' must not specify different base classes". Popup and Popup<T> have the same namespace, so could be this the problem? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
It would be a lot easier to see your code but you are correct to use You can see how we have done this here https://github.com/CommunityToolkit/Maui/blob/main/samples/CommunityToolkit.Maui.Sample/Views/Popups/ReturnResultPopup.xaml and with its associated C# file |
Beta Was this translation helpful? Give feedback.
-
My bad, silly me. I wrote xmlns:system="clr-namespace:System;assembly=System.Runtime" wrong🤦🏻😢 |
Beta Was this translation helpful? Give feedback.
It would be a lot easier to see your code but you are correct to use
x:TypeArguments
you must make sure that the .xaml.cs file also has its type defined as Popup, replacing T with your actual type.You can see how we have done this here https://github.com/CommunityToolkit/Maui/blob/main/samples/CommunityToolkit.Maui.Sample/Views/Popups/ReturnResultPopup.xaml and with its associated C# file
https://github.com/CommunityToolkit/Maui/blob/main/samples/CommunityToolkit.Maui.Sample/Views/Popups/ReturnResultPopup.xaml.cs